using System.Data.Entity; using HeuristicLab.Services.Optimization.Billing.Interfaces; namespace HeuristicLab.Services.Optimization.Billing.Utils { public static class DbContextUtil { public static void ApplyStateChanges(this DbContext context) { foreach (var entry in context.ChangeTracker.Entries()) { IObjectWithState stateInfo = entry.Entity; entry.State = StateUtil.ConvertState(stateInfo.EntityState); } } } }