views:

87

answers:

1

I need to map one entity to two tables (Invoice and InvoiceHistory). It's not up to me to merge the two database tables in one and add a status column to differentiate them.

The two tables have the exact same structure, but, as the name says, InvoiceHistory keeps a history of old invoices whereas Invoice stores active invoices. (the exact entity is not invoice but I am not allowed to disclose details plus I don't think they would be relevant anyway).

+2  A: 

Create another entity which inherits the first entity you created and does nothing else. You can then map the new entity to InvoiceHistory, while the first one is still mapped to Invoice.

Numenor
Thanks. It's what I've had in mind too. Also using Fluent NHibernate, I've also inherited from the InvoiceMapping class too.
Andrei Rinea

related questions