I have database with spatial data types. I use database first model and entity framework 6.0.2 and .NET 4.5. When I am trying to use the generated classes I get following error:
Schema specified is not valid. Errors: The relationship 'Name_FK1' was not loaded because the type 'Model.TypeB' is not available. The following information may be useful in resolving the previous error: The property 'Position' on the type 'Data.TypeB' has a property type of 'System.Data.Spatial.DbGeography' which cannot be mapped to a primitive type.
The same error is listed for all tables where I use spatial type. The ‘Name_FK1’ is foreign key relation.
What am I doing wrong?
Thank you for your help.
I fixed it! Very proud of myself :)
Hope this helps somebody else. So, from the link above (http://msdn.microsoft.com/en-US/data/dn469466) there is this line:
Before I was getting this error:
I just had to change this in my Location.cs file:
To this:
Problem solved. Thanks for posting that link @Ricky Jones.
I followed the instructions on the following link, which caused other problems I needed to solve, but it did fix my spatial issue.
http://msdn.microsoft.com/en-US/data/dn469466
This problem was caused because you created a EF 5.x DbContext Generator for a EF 6.0 edmx to solve this problem you just need to delete the old DbContext Generator and create a new one with EF 6.0 DbContext Generator.
This worked fine for me.