Way to map partitioned data using NHibernate
We have a scenario where active records are stored in one table and over time old records are archived. The table structures for the two tables - active and archive are exactly the same.
E.g DomainObject_Current : ID INT : Autoincrement Key Value INT TimeStamp
DomainObject_Archive ID INT Value INT Timestamp
On a weekly basis we move records over 30 days old to the archive table from the Current table. The ID (Primary Key) is unique across the two tables.
The application should be agnostic of whether the data is coming in from the Current table or the Archive table. What is the best way to map the Domain开发者_运维知识库Object class in this scenario?
You may try to use a view to collect two of the partitioned tables. And DomainObject map to this view.
精彩评论