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

Created Unassigned: EntityType 'DbGeography' has no key defined. Define the key for this EntityType.-> Error occur if I use base class to define a key [1535]

$
0
0
I get an error for define DbGeography in EF6 (i don't have this Error in EF5) entity type if I use it from base class to define key: for this class :

public class University
{
public int UniversityID { get; set; }
public string Name { get; set; }
public DbGeography Location { get; set; }
}
everything is correct and EntityFramework do it correctly

but if I change class to :

public class BaseClass
{
public int UniversityID { get; set; }
}
public class University:BaseClass
{
public string Name { get; set; }
public DbGeography Location { get; set; }
}
I get the following error:

One or more validation errors were detected during model generation:

Data.DbGeography: : EntityType 'DbGeography' has no key defined. Define the key for this EntityType. DbGeographies: EntityType: EntitySet 'DbGeographies' is based on type 'DbGeography' that has no keys defined.
[Stack Overflow](http://stackoverflow.com/questions/18121046/entitytype-dbgeography-has-no-key-defined-define-the-key-for-this-entitytype)
!!!??? Thanks

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>