/// <summary> /// /// </summary> /// <param name="entity"></param> public virtual void Update(T entity) { FillEntity(false, entity); // Logger.Debug("Update {0}", entity.ToString()); DbSet.Attach(entity); CurrentDbContext.Entry(entity).State = EntityState.Modified; }
/// <summary> /// /// </summary> /// <param name="entity"></param> public virtual void Delete(T entity) { // Logger.Debug("Delete {0}", entity); if (CurrentDbContext.Entry(entity).State == EntityState.Detached) { DbSet.Attach(entity); } DbSet.Remove(entity); }
public override bool IsNew(T entity) { return(CurrentDbContext.Entry(entity).State == System.Data.Entity.EntityState.Added); }
public void Delete <T>(params object[] keyValues) where T : BaseModel, new() { var entity = CurrentDbContext.Set <T>().Find(keyValues); CurrentDbContext.Entry(entity).State = EntityState.Deleted; }
public void Update <T>(T entity) where T : BaseModel, new() { CurrentDbContext.Entry(entity).State = EntityState.Modified; }
public async Task DeleteAsync <T>(params object[] keyValues) where T : BaseModel, new() { var entity = await CurrentDbContext.Set <T>().FindAsync(keyValues); CurrentDbContext.Entry(entity).State = EntityState.Deleted; }