Hi people!
I have created a custom CompositeUserType that maps two properties of a
complex domain object and it works fine. The problem is that I have many
instances of this type in another entity and each of these instances shares
the same value for one of its properties and I would like to persist them
to DB so that there's only one column for that property per table, and as
many columns for the other property as there are instances of that object.
Blaaaaaaah, that sentence is awkward! :D
Here's the deal. I'm developing an accounting application. I have an entity
called Account where I used the Money type to deal with money values, and I
have many properties in Account that are typeof(Money).
class Account {
Money DebitAmount { get; set; }
Money CreditAmount { get; set; }
Money LastYearBalance { get; set; }
Money OpeningBalance { get; set; }
... // other properties
}
In my mapping file I use my MoneyComposite type to map Money values to two
columns:
1. PropertyName_Value
2. PropertyName_Currency
This works great but unfortunately it creates a pair of such columns for
every typeof(Money) property in Account, i.e. DebitAmount has
DebitAmountValue and DebitAmountCurrency; CreditAmount has ... well you get
the picture.
Since it's only logical that an account can be bound to only one currency,
it would be better if it were possible to have only one Currency column in
the underlying table where that currency would be used for every Money
instance in the entity.
I hope I've made my question clear enough. So if anyone can please help me
with this and tell me if there's a way to achieve this (preferably) without
separating Currency from Money, I would be most grateful!
Thank you for your time!
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/MnFwQx3SJ1QJ.
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.