R – Fluent NHibernate mapping a joined sub class without the original class file

fluent-nhibernatenhibernate-mapping

I have a library with a class called Recipient which has it's own fluent mapping setup within the library.

Now in another project I have created a new class called SentEmail which inherits from Recipient, I want to be able to create a new mapping class file based on the original Recipient map. If I could update the original ClassMap file I would use

JoinedSubClass("ID", m => MAPPING HERE);

However because I can't adjust the original class map I am stuck as to how I can do this.

There must be another way to skin this cat, if anyone has any ideas they would be much appreciated.

Thanks

UPDATE

Also one thing I forgot to mention part of the details in the new SentEmail model class are stored in a seperate table to the Recipient table.

Best Answer

If you can't adjust the original mapping at all, then you're out of luck; otherwise you could use the AddPart method to add a separate instance of JoinedSubClassPart.

An aside: your design sounds a bit peculiar. SentEmail doesn't sound like it should really inherit from Recipient. SentEmail would inherit from Email, or SuccessfulRecipient from Recipient; Recipient and Email are two separate concepts.

Related Topic