Otis wrote:
Best to use IEntityCollection instead of EntityCollectionBase<type> I think, because of the lack of support for co-variance in C#/VB.NET
The interfaces are meant for this purpose: different types of collections, all usable with the same property.
public IEntityCollection Collection.
Yes, this is the solution. The IEntityCollection is exactly what I was looking for. Now this is possible:
(class1)
private IEntityCollection m_Collection;
public IEntityCollection Collection {
get { return m_Collection; }
set { m_Collection = value; }
}
and
class1Inst1.Collection = new blablaACollection();
class1Inst2.Collection = new blablaBCollection();
Wasn't that difficult
Thanks everyone for your help!
By the way, there's an EntityType-Enumeration. Is there an EntityCollectionType-Enumeration, too? Or is it somehow possible to get the type of the associated collection of a certain entity?