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; }
}
university class mapping:
class UniversityMap : EntityTypeConfiguration<University>
{
public UniversityMap()
{
this.ToTable("University");
this.HasKey(u => u.UniversityID);
}
}
everything is correct and EntityFramework does 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.
!!!??? Thanks
public class University
{
public int UniversityID { get; set; }
public string Name { get; set; }
public DbGeography Location { get; set; }
}
university class mapping:
class UniversityMap : EntityTypeConfiguration<University>
{
public UniversityMap()
{
this.ToTable("University");
this.HasKey(u => u.UniversityID);
}
}
everything is correct and EntityFramework does 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.
!!!??? Thanks