On Dec 15, 11:19 am, kimsk112 <[email protected]> wrote:
> I am sorry to hijack this thread. I just wonder why you don't use Many-
> To-Many (i.e., create an association table) to differentiate between
> those lists? Is the above method (i.e., extra property in the class)
> better way to do this?
My sample code was based on the "Examples.FirstProject", which I
hacked just enough to demonstrate the problem. You, Hudson and Paul
all raise valid points about the flaws in the design. But maybe my
choice of sample code is clouding the issue a bit.
Also, I chose to use NHibernate because I wanted to do a pure, Object
Oriented data model, without being distracted and contrained by the
minutae of the underlying DB - like which tables get mapped to which
classes, how the relationships are set up, etc. (I realize now I was
a bit naive, but ideallly, that's still the way I'd like to approach
it).
Here's the actual class I needed to map:
public class DlsAppOverlordExportRunData
{
public virtual int Id { get; private set; }
public virtual DateTime StartDateTime { get; set; }
// ... other members omitted for clarity ...
public virtual IList<DistributionResults>
LogNormalDistributionTable { get; set; }
public virtual IList<DistributionResults>
ContinDistributionTable { get; set; }
public virtual IList<DistributionResults>
NnlsDistributionTable { get; set; }
// ...
}
As you can see, this class has 3 lists of DistributionResults
objects. I firmly believe this is a good object model for our problem
domain (a scientific instrumentation application).
I also believe that it is not unreasonable to have multiple lists of
the same type in a class, and was very surprised that Automapping did
not handle it. Surely I'm not the first person who's wanted to do
this?
Solution is not that hard, once you know the "trick". I just added a
SubId member to the classes I needed to do Where overrides on, but it
seems like a bit of a kluge.
How hard would it be to make this work automatically in Fluent
Nhibernate?
-Tom
--
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en.