Why can't you just let the table for NeedsData1/2 have a foreign key
referencing the Data table?

/Oskar


2009/10/2 reflection <[email protected]>:
>
> Hello,
>
> How would you map the following Scencario?
>
> abstract class DataClass
> {
>  public Int64 DataId { get; set; }
> }
>
> class DataInt: DataClass
> {
>  public Int64 IntData { get; set; }
> }
>
> class DataString: DataClass
> {
>  public String StringData { get; set; }
> }
>
> class NeedsData1
> {
>  public DataClass Data { get; set; }
> }
>
> class NeedsData2
> {
>  public DataClass Data { get; set; }
> }
>
> My Problem is that I don't know how to map such a scenarion. As you
> may have noticed there is no relationship from the child class
> (DataClass) to the parent class (NeedsData1/NeedsData2).
>
> I could do something like this:
>
> class NeedsData1DataWrapper
> {
>  public NeedsData1 Parent { get; set; }
>  public DataClass Data { get; set; }
> }
>
> class NeedsData1
> {
>  public NeedsData1DataWrapper { get; set; }
> }
>
> class NeedsData2DataWrapper
> {
>  public NeedsData2 Parent { get; set; }
>  public DataClass Data { get; set; }
> }
>
> class NeedsData2
> {
>  public NeedsData2DataWrapper { get; set; }
> }
>
> That would be an option, but DataClass will be mapped to one table. Is
> there a possibility to map it to two tables without copying the whole
> inheritance structure. My head's on fire as I'm thinking about this
> for a few days now and I can't get a nice solution.
>
> Any help appreciated =) Thanks in advance!!!!
>
> Greetings
> Reflection
> >
>

--~--~---------~--~----~------------~-------~--~----~
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