Hi Vijaya,
There's no specific method to accomplish that, but you could create one using reflection:
public Entity RetrieveEntity(Entity entity, EntityVersion version) {
var entityType = entity.GetType();
var resultEntity = Activator.CreateInstance(entityType);
foreach (var entityProperty in EntityProperty.GetEntityProperties(entityType)) {
if (entityProperty.GetType().Name.Contains(typeof(DataEntityProperty).Name)) {
var value = ((DataEntityProperty)entityProperty).GetValue(entity, version);
TypeDescriptor.GetProperties(resultEntity)[entityProperty.Name].SetValue(resultEntity, value);
}
}
return (Entity)resultEntity;
}
However, note that the retrieved entity with the original or current values is a Detached entity with the same Id as the Entity you are trying to retrieve values from. (i.e. you shouldn't be trying to attach it to the EM)
Can you explain why you are trying to get the whole entity rather than the properties? Are trying to "roll back" the entity? (if that's the case the above wouldn't be the correct approach)
Please provide details on what you are trying to do, so I can better understand your issue and help you.
Silvio.