开发者

NHibernate: Map one class to two identical tables

I need to map one entity to two tables (Invoice and开发者_如何学JAVA 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).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜