Schema specified is not valid. Errors: 'System.Data.Spatial.DbGeography' which cannot be mapped to a primitive type

三世轮回 提交于 2019-12-10 17:11:38

问题


I'm doing Entity Framework (v6) db first. I get the following error when trying to access data from my datacontext. The relationship 'Model.FK_Table1_Table2' was not loaded because the type 'Model.Table1' is not available. The following information may be useful in resolving the previous error: The property 'Location' on the type 'Model.Table1' has a property type of 'System.Data.Spatial.DbGeography' which cannot be mapped to a primitive type.

Any idea what is causing this error?


回答1:


I don't know if this is your problem, but I had a similar error when I upgraded from EF5 to EF6. The spatial data types moved namespaces. This link has all the info:

http://msdn.microsoft.com/en-US/data/dn469466

Boiled down, you need to:

  1. Install EF6
  2. Update any namespace/using statements
  3. Remove references to System.Data.Entity
  4. (Probably) refresh your EF diagram.



回答2:


Probably you need to see the solution on this url https://msdn.microsoft.com/en-US/data/dn469466

I have fixed same problem after updating some content of my code from mentioned url page there they have given solution for update to EF-5 to EF-6 after updating some of references on my context class. it is working fine.



来源:https://stackoverflow.com/questions/18935414/schema-specified-is-not-valid-errors-system-data-spatial-dbgeography-which-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!