public static void ExceptionLogic_DeleteLogs(DeleteLogParametersEntity parameters) { Database.Query<ScheduledTaskLogEntity>().Where(a => a.StartTime < parameters.DateLimit).UnsafeDeleteChunks(parameters.ChunkSize, parameters.MaxChunks); }
public static void DeleteLogsAndExceptions(DeleteLogParametersEntity parameters) { using(Connector.CommandTimeoutScope(DeleteLogsTimeOut)) { foreach (var action in DeleteLogs.GetInvocationListTyped()) { action(parameters); } int exceptions = Database.Query<ExceptionEntity>().UnsafeUpdate().Set(a => a.Referenced, a => false).Execute(); var ex = Schema.Current.Table<ExceptionEntity>(); var referenced = (FieldValue)ex.GetField(ReflectionTools.GetPropertyInfo((ExceptionEntity e)=>e.Referenced)); var commands = (from t in Schema.Current.GetDatabaseTables() from c in t.Columns.Values where c.ReferenceTable == ex select new SqlPreCommandSimple("UPDATE ex SET {1} = 1 FROM {0} ex JOIN {2} log ON ex.Id = log.{3}" .FormatWith(ex.Name, referenced.Name, t.Name, c.Name))).ToList(); foreach (var c in commands) { c.ExecuteNonQuery(); } int deletedExceptions = Database.Query<ExceptionEntity>() .Where(a => !a.Referenced && a.CreationDate < parameters.DateLimit) .UnsafeDeleteChunks(parameters.ChunkSize, parameters.MaxChunks); } }
static void ExceptionLogic_DeleteLogs(DeleteLogParametersEntity parameters) { Database.Query<ViewLogEntity>().Where(view => view.StartDate < parameters.DateLimit).UnsafeDeleteChunks(parameters.ChunkSize, parameters.MaxChunks); }
private static void DeleteRestLogs(DeleteLogParametersEntity parameters) { Database.Query<RestLogEntity>().Where(a => a.StartDate < parameters.DateLimit).UnsafeDeleteChunks(parameters.ChunkSize,parameters.MaxChunks); }
public static void ExceptionLogic_DeleteLogs(DeleteLogParametersEntity parameters) { Database.Query<ApplicationEventLogEntity>().Where(a => a.Date < parameters.DateLimit).UnsafeDeleteChunks(parameters.ChunkSize, parameters.MaxChunks); }