Now you got what I mean ;) I actually see the fact that you should normally only work with the Domain Modell. Though the relational model suffers.
My First thought was components, too. But they don't support Inheritance. They should really introduce something like that :) I would have to do some tricks to do that. I think it is better to have a clear Domain Modell a bit messy relational modell, then having a lot of DB stuff in the domain modell which actually has no use for the Domain Modell... Well you could actually move some stuff to the DAL but I think this will get very complex. I think I'm going to map them all to the same table. I hope I don't get any problems, because the relationship can only be unidirectional. On 2 Okt., 13:50, Oskar Berggren <[email protected]> wrote: > I see what you mean. Personally I probably wouldn't mind since it's > the object model I see and work with. > > Another alternative might be to not use a separate table for Data, but > instead treating DataClass as a component, mapping it to separate > fields in t_Needsdata1 and t_Needsdata2. You would have to look this > up in the reference, I'm unsure of the details and how it works when > you have subclasses to DataClass. This option is useful if one > instance of Needsdata have exactly one instance of DataClass, and the > instances of the latter class aren't shared between different > instances of Needsdata. > > /Oskar > > 2009/10/2 reflection <[email protected]>: > > > > > > > Well I understand what you mean. I wanted to separate the Data from > > NeedsData1 and NeedsData2 because they have a different context. > > Programmatically they are exactly the same thing, but logically they > > are not. > > I didn't want to mix the template Data with the real Data in the > > Database. But maybe I'm just a bit too strict separating concerns ;) > > > On 2 Okt., 13:20, Oskar Berggren <[email protected]> wrote: > >> I think that you seem to get way to many classes for this now, with > >> the wrapper stuff. Seems strange. :) > > >> In my previous mail I didn't actually say one or two tables. You could > >> have tables t_Needsdata1 with foreign key to t_Data, and t_Needsdata2, > >> also with fk to t_Data. > > >> When you do the clone you mention, and the new instance of Data is > >> saved, it will create a new row in the t_Data table. Some rows in > >> t_Data are pointed to by t_Needsdata1, others by t_Needsdata2. And > >> your object model remains clean from the "wrappers". > > >> /Oskar > > >> 2009/10/2 reflection <[email protected]>: > > >> > Maybe it gets clearer if NeedsData2 is something like this: > > >> > class NeedsData2 > >> > { > >> > public NeedsData1 { get; set; } > >> > public NeedsData2DataWrapper { get; set; } > >> > } > > >> > NeedsData1 is the template to be used for NeedsData2. So I set > > >> > NeedsData2DataWrapper.Data = NeedsData.NeedsData1DataWrapper.Data.Clone > >> > (); //Clones the Data without the Id > > >> > NeedsData2 now has the original template value > > >> > NeedsData2.NeedsData1.NeedsData1DataWrapper.Data > > >> > and the values the class itself can change > > >> > NeedsData2.NeedsData2DataWrapper.Data > > >> > I hope you get the point :) > > >> > Greetings > >> > Reflection > > >> > On 2 Okt., 12:53, reflection <[email protected]> wrote: > >> >> Well I could have, but i would prefer to have the values for > >> >> NeedsData1 in another table then NeedsData2. The background is that > >> >> e.g. in NeedsData1 the DataClass is sort of a template and in > >> >> NeedsData2 it is sort of instance of this template - actually I copy > >> >> the values from the template to the instantiated version. > >> >> I would like to separate the templates from the instantiated values... > >> >> I think the Database Design would be clearer if I wouldn't mix those > >> >> types. > > >> >> On 2 Okt., 12:14, Oskar Berggren <[email protected]> wrote: > > >> >> > 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- Zitierten Text ausblenden - > > >> >> > - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > >> >> - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > >> - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
