public static void Delete <TEntity>(this QueryRunnerEntities context, TEntity entity) where TEntity : class { if (context.Entry(entity).State == System.Data.Entity.EntityState.Detached) { context.Set <TEntity>().Attach(entity); } context.Set <TEntity>().Remove(entity); }
public static void Update <TEntity>(this QueryRunnerEntities context, TEntity entity) where TEntity : class { context.Set <TEntity>().Attach(entity); context.Entry(entity).State = System.Data.Entity.EntityState.Modified; }
public static TEntity Insert <TEntity>(this QueryRunnerEntities context, TEntity entity) where TEntity : class { return(context.Set <TEntity>().Add(entity)); }