nhibernate - Ignore column using mapping by code in HNibernate -


i'm using mapping code in nhibernate. got class several properties. 1 of them not related columns in db still has getter , setter.

i use conventionmodelmapper not modelmapper. first 1 assumes properties mapped.

how can tell nhibernate ignore it?

why not map properties want , leave ones not needed mapped

check this

you can manage persistence of conventionmodelmapper following:

mapper.beforemapproperty += (mi, propertypath, map) => {     // code here using mi, propertypath, , map decide if want skip property .. can check property name , entity name if want ignore }; 

a better answer be:

mapper.ispersistentproperty((mi, declared) =>                                              {                                                  if (mi.declaringtype == typeof (yourtype) && mi.name == "propertynametoignore")                                                      return false;                                                  return true;                                              }); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -