public FaustMigrationHistory Update(FaustMigrationHistory entity, UserContext userContext) { Logger.Log(string.Format(Resources.Accessors_Updating, typeof(FaustMigrationHistory).Name, entity.FaustMigrationHistoryId), TraceEventType.Verbose); using (var db = new FaustDB(userContext)) { db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); } Logger.Log(string.Format(Resources.Accessors_Updated, typeof(FaustMigrationHistory).Name, entity.FaustMigrationHistoryId), TraceEventType.Verbose); return(entity); }
public FaustMigrationHistory Delete(FaustMigrationHistory entity, UserContext userContext) { if (entity == null) { throw new ArgumentException(Resources.Error_DeleteEntityParameterNull, "entity"); } using (var db = new FaustDB(userContext)) { db.Entry(entity).State = EntityState.Deleted; db.SaveChanges(); } Logger.Log(string.Format(Resources.Accessors_Deleted, typeof(FaustMigrationHistory).Name), TraceEventType.Verbose); return(entity); }
public FaustMigrationHistory[] DeleteDebugEntries(UserContext userContext) { Logger.Log("FaustMigrationsHistoryAccessor - Deleting all debug Migration Histories", TraceEventType.Verbose); FaustMigrationHistory[] deletedHistories = new FaustMigrationHistory[0]; using (var db = new FaustDB(userContext)) { IEnumerable <FaustMigrationHistory> histories = db.Set <FaustMigrationHistory>().Where(fmh => fmh.ReleaseNumber < 0); deletedHistories = histories.ToArray(); histories.ForEach(h => db.Entry(h).State = EntityState.Deleted); db.SaveChanges(); } Logger.Log(string.Format("FaustMigrationsHistoryAccessor - Deleted {0} Migration Histories", deletedHistories.Length), TraceEventType.Verbose); return(deletedHistories); }
public virtual FaustMigrationHistory[] DeleteMany(FaustMigrationHistory searchCriteria, UserContext userContext) { if (searchCriteria == null) { throw new ArgumentException(Resources.Error_SearchParameterNull, "searchCriteria"); } FaustMigrationHistory[] foundArray = FindMany(searchCriteria, userContext); using (var db = new FaustDB(userContext)) { foreach (FaustMigrationHistory entity in foundArray) { db.Entry(entity).State = EntityState.Deleted; } db.SaveChanges(); } Logger.Log(string.Format(Resources.Accessors_DeletedMany, foundArray.Length, typeof(FaustMigrationHistory).Name), TraceEventType.Verbose); return(foundArray); }