问题
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:
- Install EF6
- Update any namespace/using statements
- Remove references to System.Data.Entity
- (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