private static void ExecuteInitialization(RioValleyChiliDataContext context, IDataContextInitializationAdapter <RioValleyChiliDataContext> initializationAdapter, string[] args) { ContextsHelper.ConsoleOutputSettings(); RVCDataLoadLoggerGate.RVCDataLoadLogger = RVCDataLoadLogger.GetDataLoadLogger(ExtractArgs(args, "-LogFolder ")); if (context.Database.Exists()) { Console.WriteLine("Preserving old data."); PreservedData.ObtainData(context); Console.WriteLine("Deleting existing database."); context.Database.Delete(); } Console.WriteLine("Initializing database."); var stopwatch = new Stopwatch(); stopwatch.Start(); DataLoadResult.Success = true; initializationAdapter.InitializeDataContext(ref context); new RVCDataLoadResultObtainer().SetDataLoadResult(new RVCDataLoadResultObtainer.LoadResult { Success = DataLoadResult.Success, RanToCompletion = true, TimeStamp = DateTime.Now }); stopwatch.Stop(); Console.WriteLine("\n****************************************"); Console.WriteLine("DATA LOAD COMPLETE"); Console.WriteLine("Success: {0}", DataLoadResult.Success); Console.WriteLine("Total Run Time: {0:g}", stopwatch.Elapsed); Console.WriteLine("****************************************\n"); if (RVCDataLoadLoggerGate.RVCDataLoadLogger != null) { RVCDataLoadLoggerGate.RVCDataLoadLogger.WriteLogSummary(); } }
public static Action <string> LogSummaryEntry(string logName) { return(RVCDataLoadLogger != null?RVCDataLoadLogger.LogSummaryMessage(logName) : null); }