Hey there
I'm new to NHibernate (or mappers in general), so bear with me :) The design is quite simple: Given two tables Announcement adn AnnouncementText. AnnouncementText contains the language-depending rows. If the system has two languages, for each entry in Announcement you would find two entries in AnnouncementText. Quite simple so far.
The Domain-Model would then contain two classes, mapping the two tables. In the class Announcement I would store an IList for AnnouncementText, and maybe a helper-getter where I could receive the wished language. I would let the class Announcement construct the two (if two languages) AnnouncementText-instances in the constructor, making sure the date is well shaped when a new entry is created.
Mapping with NHibernate shouldn't be a problem, simple many-to-one relation as far as I understood. My only concern is the following: since NHibernate also will use Announcement's constructor, two AnnouncementText will be constructed. Will NHibernate overwrite these two instances in the IList when loading the two entries from the DB? Or would you recommend some other design?
Any tips much appreciated!
Regards sl3dg3
|