I'm using EF 6 and I'm getting a really strange error on one of my models:
The fields configuration is :
Property(x => x.IncidentLocationGps).HasColumnName("IncidentLocationGPS").IsOptional();
And the error is:
The type 'System.Data.Spatial.DbGeography' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method
Thanks in advance for your help
This was the solution that I found in the end after digging a bit further in to EF6 documentation.
Removing assembly references to System.Data.Entity.dll
Installing the EF6 NuGet package adds the following runtime assemblies to your project:
Recent builds of the EF6 NuGet package removes reference to System.Data.Entity.dll from the project.
EF6 doesnâ€™t use any code from System.Data.Entity.dll and having it referenced in your project could cause build conflicts.
These conflicts can be resolved but in general you should not be using EF6 and System.Data.Entity.dll in the same application.
Hope this may help anyone else who faces the same issue.