How do I use the DbGeography Spatial Data Type with EF4.1
I'm using Entity Framework 4.开发者_开发技巧1 Code First and have been trying to add a field to represent a Geography column. However, the datatype DbGeography is not recognized. I've found references to the System.Data.Spatial namespace online, but I can't find out which Assembly contains it. I found one website that said I needed to install the System CLR Types for SQL Server 2008 R2, but when I tried that the installer said I already had a more recent version installed. I tried adding a few different SqlServer assemblies, but none seemed to work.
One may see this error
The type or namespace name 'Spatial' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
You will not find it because it is not there. It is only available in first CTP of the next version of Entity framework (Entity Framework July 2011 CTP). Entity framework prior to this CTP doesn't support SQL spatial types.
精彩评论