I am hitting ModelValidationException when I use CodeFirst/DbModelBuilder to build my data model. One of my entities has DbGeography property. As long as I run the app, I will get the below exception:
One or more validation errors were detected during model generation:
\thttp://schemas.microsoft.com/ado/2009/11/edm.DbGeography: : EntityType 'DbGeography' has no key defined. Define the key for this EntityType.
I tried EF 5 and EF 6 apha1 and had the same issue.
Comments: Actually, playing a bit more with this I found that it is enough to do modelBuilder.Entity<DbGeography>(), even for an EDM version that does support spatial. Is it possible that your application is making this call somehow?
One or more validation errors were detected during model generation:
\thttp://schemas.microsoft.com/ado/2009/11/edm.DbGeography: : EntityType 'DbGeography' has no key defined. Define the key for this EntityType.
I tried EF 5 and EF 6 apha1 and had the same issue.
Comments: Actually, playing a bit more with this I found that it is enough to do modelBuilder.Entity<DbGeography>(), even for an EDM version that does support spatial. Is it possible that your application is making this call somehow?