I have an inheritance structure :
1
/ \
2 3
where:
1 = Relation (SuperType) Abstract
2 = Contact (SubType) Concrete
3 = Organization (SubType) Concrete
I'm using a Generic Repository:
public class LlblGenRepository<TEntity> : IRepository<TEntity> where TEntity : EntityBase2, IEntity2
{
...
}
Now I want to save a ContactEntity and get the error:
"The given key was not present in the dictionary"
I think this exception raises because there is no RelationEntity created before the ContactEntity is created.
Even when I try to Create the RelationEntity earlier (adapter.SaveEntity((RelationEntity)ContactEntity) it still tries to create the ContactEntity instead of the RelationEntity.
So my question is: How can I create/store an entity with an abstract supertype?