take a look at <many-to-any>

On Wed, Dec 17, 2008 at 6:13 AM, Germán Schuager <[email protected]>wrote:

> Hi,
> I have a base class with an abstract component represented by an interface:
>
> public abstract class BaseClass
> {
>    public abstract ICustomComponent CustomComponent { get; }
> }
>
>
> Then, I have several subclasses that provide their specific concrete
> intances (to achieve diferent behaviors) using this abstract property; note
> that it could be null:
>
> public class FirstClass
> {
>    public override ICustomComponent CustomComponent {
>       get {
>          if (customComponent == null) customComponent = new
> FirstConcreteCustomComponent();
>          return customComponent;
>       }
>    }
> }
>
> public class SecondClass
> {
>    public override ICustomComponent CustomComponent {
>       get {
>          if (customComponent == null) customComponent = new
> SecondConcreteCustomComponent();
>          return customComponent;
>       }
>    }
> }
>
> public class ThirdClass
> {
>    public override ICustomComponent CustomComponent {
>       get { return null; }
>    }
> }
>
>
> I would like to map this set of classes using table-per-subclass
> inheritance mapping.
> Is it possible? How can I do it?
>
> I have wrote some mappings that let me persist a FirstClass entity, but
> when I try to get it from the DB it yells:
> "Cannot instantiate abstract class or interface: ICustomComponent"
>
> Regards,
>
>
> Germán Schuager
> blog.schuager.com
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to