I'm using the table-per-subclass method. I have a base class with 3 subclasses. A base object can be one or more of the subclasses. So I can have an entity with id 11 of each of the subclass types. The subclass is an abstract class with several common properties and the subclasses each have some specialized properties of their own.
If I've loaded subclass 1 id 11 and attempt to load subclass 2 id 11 in EntityKey.Equals(object) it checks for equality by comparing the id (which is obviously equal) and the identifierSpace with is built using the base class type so again these are equal and it it will then throw an objectNotFoundException.
I'm using MappingAttributes so here is the base class attribute:
Code:
[Class(0, NameType=typeof(BaseClass), Lazy=false, Polymorphism = PolymorphismType.Explicit, ProxyType=typeof(BaseClass))]
and each subclass attribute looks like this:
Code:
[JoinedSubclass(0, NameType = typeof(SubClass1), Lazy = false, ProxyType = typeof(SubClass1), ExtendsType = typeof(BaseClass), SelectBeforeUpdate = true)]