Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: DbGeography that has no keys defined. [650]

$
0
0
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: I found out the reason. It was my stupid mystake. I used the wrong namespace. Replaced System.Data.Spatial with System.Data.Entity.Spatial solved my problem. Thanks for your time.

Viewing all articles
Browse latest Browse all 10318

Trending Articles