Mappings?
Diego
On Mon, Aug 16, 2010 at 04:26, Miha V <[email protected]> wrote:
> Hi!
>
> I have a need to store several collections of the same "EntityType".
> For instance, I have a class
>
> public class HourlyRate
> {
> public virtual int Id { get; set; }
> public virtual DateTime ValidFrom { get; set; }
> public virtual DateTime ValidTo { get; set; }
> public virtual decimal Amount { get; set; }
> }
>
> Then, on several entities, I would have
>
> public class Employee {
> public ISet<HourlyRate> RegularRates { get; set; }
> public ISet<HourlyRate> NighltyRates { get; set; }
> // etc.
> }
>
> I noticed that RegularRates and NighltyRates get mixed up in the
> database -- they don't get stored as one would expect.
>
> How to model this in OO terms so that NHibernate picks it up as
> smoothly as possible?
>
> I tried subclassing HourlyRate and that creates a table for each
> "Rate", but I'd rather see that there would be a discriminator column
> on the table holding HourlyRates. I tried changing the strategy to
> table-per-subclass-hierarchy, but then I get WrongClassException when
> loading entities.
>
> Thanks,
> Miha
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
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.