Hi,
I'm fairly new to NHibernate, and am trying to use it to write an app against a legacy database. Mostly I'm getting on OK, but I'm a bit stuck with the following. I have a table, EDIAction, which has two many to one tables beneath it, EDIEmailRecipients and EDIFTPRecipients. These are defined as follows:
CREATE TABLE EDIEmailRecipients
ID int IDENTITY(1,1),
ActionID int,
Sender varchar(200),
etc
and
CREATE TABLE EDIFTPRecipients
ID int IDENTITY(1,1),
ActionID int,
Server varchar(50),
etc
So, both have their own identity columns, and both point back to the EDIAction table via the ActionID column.
In my code I have an interface IEDIRecipient which specifies two read only properties, RecipientType ("Email" or "FTP") and Summary, which basically provides a human readable description of the recipient.
In my EDIAction class I'd like to have a collection of IEDIRecipients. I'd like NHibernate to load the collection for me, and ideally I'd like to be able to add concrete classes to the collection and have NHibernate save them to the appropriate table. I don't need any other functionallity than this
I've looked at the docs on this, and it looks like I need to use the table per concrete class strategy (I'm not able to change the database schema), but I can't quite figure out how to do it. I've got mappings for each of the recipients tables, which work fine, but I'm not sure what to do with the <any> tag, or how to specify the collection of IEDIRecipients in my EDIAction mapping file.
Can anyone help?
Kev
|