lundi 10 août 2015

Get original values for each object property

I'm using Entity Framework 6 and vb.net 2013.

I have a case when i use reflection to return for an object ( of whatever entity ) , property names and current values :

 Dim values = obj.GetType.GetProperties.Where(Function(t2) t2.PropertyType.IsValueType).Select((Function(t3) New With { _
    .property = t3.Name, _
    .value = t3.GetValue(obj, Nothing) _
})).ToDictionary(Function(x) x.property, Function(y) y.value)

This code is working without problems , but instead of current values that this expression return , I need to get the original values for each property.

What changes should I make on my expression ?

Thank you !





Aucun commentaire:

Enregistrer un commentaire