Saturday, 15 May 2010

c# - Entity Framework - Check if property is mapped -



c# - Entity Framework - Check if property is mapped -

i'm using entity framework , triggering property changed event, i'd update property if property changed mapped.

protected void foopropertychanged(object sender, propertychangedeventargs e) { var notmappedarray = typeof(foo).getproperty(e.propertyname).getcustomattributes(typeof(notmappedattribute), false); // thought might homecoming null if property did not have attribute. not. //if (notmappedarray == null) unitofwork.value.getrepository<foo>().update(myfoo); }

what best way find if property sent event mapped in entity framework?

edit: i've seen this question. however, seems reply going little overboard, , doesn't quite need.

my problem in foo class. apparently had floating [notmapped] attribute far above property checking. ended using this:

protected void foopropertychanged(object sender, propertychangedeventargs e) { var notmapped = typeof(foo).getproperty(e.propertyname).getcustomattributes(typeof(notmappedattribute), false); if (notmapped.length == 0) { unitofwork.value.getrepository<foo>().update(myfoo); } }

c# entity-framework data-annotations inotifypropertychanged

No comments:

Post a Comment