views:

225

answers:

1

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.

+1  A: 

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.

James Gregory
That is a good point thanks James, I have amended the name to be RecipientEmailHistory as it is more related to the recipient than the email.I've also decided that creating a map for the file was unneccesary because it was a read only class so I create a query and transform it into my new model using NHibernate.Transform.Transformers.AliasToBean.Thanks for your assistance.
John_

related questions