NHibernate filter collection

前端 未结 2 1113
予麋鹿
予麋鹿 2021-01-13 06:48

Using NHibernate I want to filter a collection in a class to contain ONLY a subset of possible objects. Below I am including a sample table data to help explain. I can fin

2条回答
  •  攒了一身酷
    2021-01-13 07:42

    Presumably your VersionNumber increments as the user changes the data and you're trying to get the latest one. If you consider the VersionNumber as an "Age" field instead (i.e. where 0 is the latest / youngest version, 1 is the next oldest and so on) then your problems becomes how to get all the entities with an Age of 0. This can be done using a filter: http://nhibernate.info/doc/nh/en/index.html#objectstate-filters

提交回复
热议问题