I have an entity by getting it from DbEntityEntry.Entity. This returns the Entity Framework proxy for the entity.
How do I access the underlying object
While working with EF 6 i used the following code to get the underlying POCO entity type from proxy type,
var entityType = ObjectContext.GetObjectType(dbEntitymodifiedEntry.Entity.GetType());
ObjectContext.GetObjectType : Return the POCO from proxy object
reference : https://docs.microsoft.com/en-us/ef/ef6/fundamentals/proxies