开发者

Way to map partitioned data using NHibernate

开发者 https://www.devze.com 2023-01-25 01:15 出处:网络
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.

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.

0

精彩评论

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

关注公众号