Esempio n. 1
0
 public static void ApplyStateChanges(this DbContext context)
 {
     foreach (var entity in context.ChangeTracker.Entries <IObjectsWithState>())
     {
         IObjectsWithState stateInfo = entity.Entity;
         entity.State = StateHelpers.ConvertState(stateInfo.State);
     }
 }
 public static void ApplyStateChanges(this IContext context)
 {
     foreach (var entry in (context as DbContext).ChangeTracker.Entries <IAudit>())
     {
         IAudit stateInfo = entry.Entity;
         entry.State = StateHelpers.ConvertState(stateInfo.State);
     }
 }
Esempio n. 3
0
 public void InsertOrUpdate(Products products)
 {
     if (products.Id == default(int))
     {
         context.Entry(products).State = EntityState.Added;
     }
     else
     {
         context.Products.Add(products);
         context.Entry(products).State = StateHelpers.ConvertState(products.State);
     }
 }