且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

实体框架6和空间数据

更新时间:2023-02-13 17:29:08

我修好了!很为自己感到骄傲:)

I fixed it! Very proud of myself :)

希望这可以帮助别人。所以,从上面的链接( http://msdn.microsoft.com/en-US/data/dn469466一>)这行:

Hope this helps somebody else. So, from the link above (http://msdn.microsoft.com/en-US/data/dn469466) there is this line:

空间类(如DbGeography,DbGeometry)已经从
移动System.Data.Spatial => System.Data.Entity.Spatial

Spatial classes (e.g. DbGeography, DbGeometry) have moved from System.Data.Spatial => System.Data.Entity.Spatial

在我得到这个错误:

的关系IntakeModel.FK_Assignee_HomeLocation未加载
,因为类型'IntakeModel.Location不可用。在
下列信息可能会解决以前的错误有用:
酒店'地理'的类型'ConsoleApplication3.Location'有'System.Data.Spatial.DbGeography的
属性类型'不能被映射到一个基本类型

The relationship 'IntakeModel.FK_Assignee_HomeLocation' was not loaded because the type 'IntakeModel.Location' is not available. The following information may be useful in resolving the previous error: The property 'Geo' on the type 'ConsoleApplication3.Location' has a property type of 'System.Data.Spatial.DbGeography' which cannot be mapped to a primitive type.

我只是在我的Location.cs文件来改变这样的:

I just had to change this in my Location.cs file:

public System.Data.Spatial.DbGeography Geo { get; set; }

要这样:

public System.Data.Entity.Spatial.DbGeography Geo { get; set; }



问题解决了。感谢张贴该链接@Ricky琼斯。

Problem solved. Thanks for posting that link @Ricky Jones.