public virtual async Task <Maybe <T> > UpdateAsync(T entity) { HexadoDbContext.Set <T>().Update(entity); await HexadoDbContext.SaveChangesAsync(); await HexadoDbContext.Entry(entity).ReloadAsync(); HexadoDbContext.Entry(entity).State = EntityState.Detached; return(entity.ToMaybe()); }
public virtual async Task <Maybe <T> > GetAsync(string id) { var entity = (await HexadoDbContext.Set <T>() .FindAsync(id)) .ToMaybe(); if (!entity.HasValue) { return(entity); } HexadoDbContext.Entry(entity.Value).State = EntityState.Detached; return(entity); }