Filter entities on mapping level in NHibernate -


let's have , database table called people, , entity people. let's need quick way remove subset of people displaying everywhere in application. add isdeleted column people table, , set values in column 1.

in entity framework there's mechanism specifies instans of entities value in column isdeleted set 1 shouldn't fetched , mapping framework filters data automatically. is possible achieve nhibernate?

you can create abstract class, e.g. peoplebase, people class derived , map entity it.
after can use discriminator (didn't check correctness, should work):

 <class name="yournamespace.peoplebase,yournamespace" table="people">    // ...    <discriminator column="isdeleted" type="boolean" />     // properties...    // ...    <subclass name="yournamespace.people, yournamespace" discriminator-value="false">    </subclass> </class> 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -