Came across a most odd error during model generation.
Apparently, the following is allowed:
public abstract class Entity
{
public string CreatedBy { get; set; }
public string ModifiedBy { get; set; }
}
public class Car
{
public int CarId { get; set; }
}
But this isn't allowed:
public abstract class ReferenceEntity : Entity
{
}
public class CarType : ReferenceEntity
{
public int CarTypeId { get; set; }
}
I will receive the following error: ReferenceEntities: EntityType: EntitySet 'ReferenceEntities' is based on type 'ReferenceEntity' that has no keys defined.
Neither abstract class defines a key, I leave that up to each concrete class. I was trying to get around the TPC issue where identity problems arise when the identity key is placed in an abstract class when ids are automatically generated by the DB.
Help?
Another question. For my abstract classes, am I allowed to specify EntityTypeConfigurations? This is using Entity Framework 6.