Spatial Types in the Entity Designer


One of the highly-anticipated features coming in the next version of Entity Framework is Spatial support. We’d like to give you a look at the experience of developing with Spatial types in the Entity Designer. If you haven’t already, take a look at what is going on under the hood with Spatial types in the Entity Framework in the blog post here

We’d like to show you what is coming your way for Spatial types in the Entity Designer and of course, let us know what you think and give us feedback on the experience!

Goals

The goals for supporting Spatial types in the Entity Designer align with Entity Framework design goals for Spatial as well:

  • First class support for Spatial types in the Entity Designer
  • Model-first and Database-first support through the Entity Designer

Spatial Types

  • Geometry
  • Geography

Experience

Since the Entity Framework adds Spatial types as primitive EDM types, we treat them exactly as you are used to using primitive types in the Entity Designer.

  1. Add Property to Entity Type
  2. Set Data Type as Geography through the Property Window

 

 

 

 

Restrictions

Spatial types cannot be used as entity keys, in associations, or as discriminators. We give design-time validation errors if you attempt to use one of those invalid patterns.

 

  1. Attempt to set property of type Geometry as entity key
  2. Validation error in Error List

 

 

Feedback

As always, please let us know what is most valuable to you in the Entity Designer for using Spatial data types. Feedback is always appreciated!

 

 

Thank you,

Sarah McDevitt

Program Manager

Comments (12)

  1. Fujiy says:

    What did you mean with "Next version of Entity Framework"? 4.2 or I will need to wait for .NET 5?

  2. Ben says:

    Great! And will the hierarchyid-datatype also supported in the next release?

  3. What about XML datatypes?

  4. Jan says:

    Yes, I would like to know the same thing. Are we talking 4.2?

  5. Lee Timmins says:

    @Fujiy and @Jan: I think we're talking .NET 4.5. The devs always said that they needed framework changes to support Enums and if you build a sample application with this CTP then you need to target a different version of the framework.

    I'm assuming the next version of the framework will be .NET 4.5 from the Windows 8 leaks i've read about. I'm sure we'll know more after Build.

  6. Russell says:

    This is a great boost . . However a post with a Filestream varbinary(max) and Sql geography would be worth considering

  7. Great to see the spatial support!  I am writing a Bing Map application (not a Bing Map App) in Silverlight 4 and I'm curious to know how the spatial data types can be converted into MapPolygon, MapPolyLine, and Multi-polyling/polygon types.

    In a perfect world, the Add() method of BingMap (Silverlight) would accept/draw these new EF spatial types.  For instance MapLayer.Add(new MapPolygon(dbContect.myGeometry as LocationCollection));  or something to that effect.  (My code currently spins through a text field that contains lat/long locations in a column (a geometry column is the next column in the database and I would much rather use the geometry column and avoid text spinning.:D )

    What does the Bing Maps team think about the new spatial support?

    Thoughts?

    Thanks again and great job adding spatial support!

    Mike

  8. Rus says:

    I have developing a web app based on Spatial Data . But since i am moving to EF for easy CRUD functionality  I am Stuck . I even Downloaded the EF june 2011CTP but still it shows the error like"Error 0040: Type Geography is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualifification" where my Photo Location is equiped with a Geography location. …………..When will this be available ………Any Help regarding Spatial Data and FileStream varbinary(max) Column would be highly appreciated

  9. Ido Flatow says:

    Just checked VS 11 on Win8, no geography support there.

    I also wonder when this feature will be released. VS 2010 SP2?

  10. Benjamin Chebrou says:

    Hello,

    After reading this aricle and watch this video channel9.msdn.com/…/SAC-812T, I can't wait  any longer to test Spatial Data with my WCF Data Services ! 🙂

    But in the What's new in .Net 4.5 page there is nothing about new features in EF. Is Spatial Data will come with .Net 4.5 ?

    Thanks,

    Ben

  11. So cool to have GeoGraphy support. Just have a Map project. Can't wait .net 4.5!! Cheers