public virtual void Update(T entity)
{
T current = this.Where(m => m.Id.Equals(entity.Id))
.SingleOrDefault();
if (current != null)
{
var context = ((IObjectContextAdapter)DbContext).ObjectContext;
ObjectStateEntry objectStateEntry;
if (context.ObjectStateManager.TryGetObjectStateEntry(current, out objectStateEntry))
{
objectStateEntry.ApplyCurrentValues(entity);
objectStateEntry.SetModified();
this.Commit();
}
}
}