Written as regards to Entity Framework v6.1.1 implementation.
If you are looking for a specific classes like GeographyPoint instead of DBGeography for your property then there's no such in Entity Framework implementation.
All geography-related stuff for Entity Framework is concentrated in one System.Data.Entity.Spatial.DBGeography class. Instance of such class can act differently based on actual data.
For example, if you work with a Point, you can access Elevation, Longitude and Latitude properties.
If it's actually a collection, you can access ElementCount property.
And in your queries you can use DbGeography methods (i.e. Distance()) to perform type-specific queries like:
var myLocation = DbGeography.FromText("POINT(40.7127, 74.0059)");
var results = from p in Points
orderby p.Distance(myLocation)
select p;
Actually, I don't see a 'Use strong spatial types' property running VS 2013.3, EF Power Tools Beta 4.
UPDATE
Found it under actual data model properties. Well, it's more of a question to developers of EF, but if you look at the source code of EFEntityModelDescriptor (component that describes all those extension menu items), there are two properties that responsible for Use Strong Spatial Types
menu item:
UseStrongSpatialTypes
which returns true by-default or calls GetUseStrongSpatialTypesFeatureState
:
internal static FeatureState GetUseStrongSpatialTypesFeatureState(Version schemaVersion)
{
Debug.Assert(EntityFrameworkVersion.IsValidVersion(schemaVersion), "Invalid schema version.");
return schemaVersion > EntityFrameworkVersion.Version2
? FeatureState.VisibleAndEnabled
: FeatureState.VisibleButDisabled;
}
As you can see, all EF versions above 2 should return FeatureState.VisibleAndEnabled
. Current implementation is EntityFrameworkVersion.Version3
, but still menu item is disabled and still its value is false. We see false in the designer because of the annotation specified in Conceptual Model in your edmx-file that explicitly set it to false:
<!-- CSDL content -->
<edmx:ConceptualModels>
<Schema xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation"
annotation:UseStrongSpatialTypes="false">
</Schema>
</edmx:ConceptualModels>
This is set to false on the generation phase in EdmXmlSchemaWriter
if (_version == XmlConstants.EdmVersionForV3)
{
_xmlWriter.WriteAttributeString(
AnnotationNamespacePrefix,
XmlConstants.UseStrongSpatialTypes,
XmlConstants.AnnotationNamespace,
XmlConstants.False);
}
But if EF version is 3 and FeatureState is VisibleAndEnabled why is the menu item is disabled?
That leads us to the next property:
IsReadOnlyUseStrongSpatialTypes
with the following implementation (true always):
internal bool IsReadOnlyUseStrongSpatialTypes()
{
// TODO: when runtime support for the other (true) setting of this attribute is available replace the "return true" below by the commented line below it
return true;
// return (!EdmFeatureManager.GetUseStrongSpatialTypesFeatureState(TypedEFElement.Artifact.SchemaVersion));
}
As you can see, it always returns true and from a TODO
comment we can guess that there's no support for this currently.
Unfortunately, there's no source code available for older versions of EntityDesign
project, so it's hard to track why exactly this was changed.
As Pawel mentioned in this comment, EF team wanted to adopt some existing spatial library (without having to implement and maintain it), but there was no options, so they implemented simpler DbGeography and DbGeometry classes until other options become available.
Probably, since then IsReadOnlyUseStrongSpatialTypes
property was changed to always return true, so that Use Strong Spatial Types
menu item is greyed-out in the designer and a Description note was added about DbGeography and DbGeometry types used.
SUMMARY
Just to summarize my answer - it's disabled because it is not applicable for Entity Framework v5.0 and onwards (and corresponding versions of Visual Studio) - implementation has changed.