Thanks for the input Gabriel.
I am afraid your suggestion might be the most straightfoward way to do
this without making my domain object depend on an IREpository.
The problem is enforcing some rules, notably 'only one test of type T
may be 'Approved within an Sample'' in a straightforward manner.
Putting this info on the test instead of the sample pushes me into
introducing some kind of ITestApprovalService with calls like
'IsApproved' for each time I view the test. I was trying to see if I
could keep this directly on the Sample entity so I could have this:
SampleTest{
IsApproved{get;}
IMaterialsTest {get;}
...other info
}
Sample {
ICollection<SampleTest> {get;}
Approve(IMaterialsTest test);
}
But since IMaterialsTest has alot of different implementations and is
not mapped directly in NHib, this can not be easily modeled
relationally.
On Nov 17, 11:36 pm, "Gabriel Schenker" <[EMAIL PROTECTED]> wrote:
> why not introduce an entity TestSample which references the entity Sample?
> IMaterialsTest then holds a collection of TestSample
>
> On Mon, Nov 17, 2008 at 7:28 PM, Mike Nichols <[EMAIL PROTECTED]>wrote:
>
>
>
> > I have this model:
>
> > interface IMaterialsTest { Sample{get;set;} }
> > abstract class Sample { ... }
>
> > Originally, I was thinking a many-to-one relation made sense but as it
> > happens I now need to track some info about the relationship between
> > the sample and materials tests by adding an 'Approved' property, among
> > other descriptors.
>
> > My thought was to invert the relationship to a one-to-many (with
> > Sample holding the collection) and wrapping the reference to
> > IMaterialsTest inside an ValueObject called descriptor, but that would
> > be tough since IMaterialsTest has many implementations.
>
> > Would you recommend introducing something like SampleTestDescriptor as
> > a ValueObject and removing the direct references to the entities in
> > the object model?
>
> > Assuming I don't want a big table called 'MaterialsTest' and use the
> > joined-subclass strategy in NHib, how else can I model or map
> > something like this?
>
> > thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---