Example #1
0
 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);
 }
Example #2
0
 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;
 }
Example #3
0
 public static TEntity Insert <TEntity>(this QueryRunnerEntities context, TEntity entity) where TEntity : class
 {
     return(context.Set <TEntity>().Add(entity));
 }