我正在使用Entity Framework,并触发属性更改事件,如果更改的属性已映射,则希望更新属性。
protected void FooPropertyChanged(object sender, PropertyChangedEventArgs e)
{
var notMappedArray = typeof(Foo).GetProperty(e.PropertyName).GetCustomAttributes(typeof(NotMappedAttribute), false); // I thought this might return null if the property did not have the attribute. It does not.
//if (notMappedArray == null)
UnitOfWork.Value.GetRepository<Foo>().Update(MyFoo);
}
如何找到传递给此事件的属性是否在实体框架中映射的最佳方法是什么?
编辑:我看到了这个问题。但是,它似乎有点过度,不太符合我的需求。