mardi 16 août 2016

Entity Framework get properties including some values

I have a method which iterates through all the properties of an object. I am logging those properties:

Object obj = entry.Entity;
Type type = obj.GetType();
PropertyInfo[] properties = type.GetProperties();

 foreach (PropertyInfo property in properties)
 {
     oldData.AppendFormat("{0}={1} || ", property.Name, property.GetValue(obj, null));
 }

Now this is working fine but on my table log, it is also writing this properties below:

- PremiumReference=System.Data.Objects.DataClasses.EntityReference`1[CACIB.CPM.WebCPM.Data.Premium]
- EntityState=Deleted
- EntityKey=System.Data.EntityKey

Any ideas why this properties are being included?





Aucun commentaire:

Enregistrer un commentaire