public FaustMigrationHistory[] FindMany(FaustMigrationHistory searchCriteria, UserContext userContext) { Logger.Log(string.Format(Resources.Accessors_FindMany, typeof(FaustMigrationHistory).ToString()), TraceEventType.Verbose); var predicate = SetupFindMany(searchCriteria, userContext); predicate = SearchCriteriaExpression(searchCriteria, predicate); FaustMigrationHistory[] result; using (var db = new FaustDB(userContext)) { result = db.Set <FaustMigrationHistory>().AsExpandable().Where(predicate).ToArray(); } Logger.Log(string.Format(Resources.Accessors_FoundMany, result.Length, typeof(FaustMigrationHistory).ToString()), TraceEventType.Verbose); return(result); }
public FaustMigrationHistory Create(FaustMigrationHistory entity, UserContext userContext) { Logger.Log(string.Format(Resources.Accessors_Create, typeof(FaustMigrationHistory).Name), TraceEventType.Verbose); if (entity == null) { throw new ArgumentException(Resources.Error_CreateEntityParameterNull, "entity"); } using (var db = new FaustDB(userContext)) { db.Set <FaustMigrationHistory>().Add(entity); db.SaveChanges(); } Logger.Log(string.Format(Resources.Accessors_Created, typeof(FaustDB).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); }