public static void Register(string settingsFile, string costDataFile, string exportFile = "", EnExportType exportType = EnExportType.Console, IHtmlWrapper wrapper = null) { IMlogger mLogger = new Mlogger(); IAppConfiguration appConfig = new ApplicationConfiguration(settingsFile, costDataFile); TinyIoCContainer.Current.Register<IMlogger>(mLogger); TinyIoCContainer.Current.Register<IAppConfiguration>(appConfig); IDataExporter exporter = null; switch (exportType) { case EnExportType.Console: exporter = new ConsoleWriter(); break; case EnExportType.Csv: exporter = new CsvExporter(mLogger, exportFile); break; case EnExportType.Html: if (wrapper != null) { exporter = new HtmlExporter(mLogger, exportFile, wrapper); } else { // Fall back to Consolewriter - ideally we should log this failure... exporter = new ConsoleWriter(); } break; } TinyIoCContainer.Current.Register<IDataExporter>(exporter); }
public static void Register(string settingsFile, string costDataFile) { IMlogger mLogger = new Mlogger(); IAppConfiguration appConfig = new ApplicationConfiguration(settingsFile,costDataFile); IDataExporter dataExporter = new ConsoleWriter(); TinyIoCContainer.Current.Register<IMlogger>(mLogger); TinyIoCContainer.Current.Register<IAppConfiguration>(appConfig); TinyIoCContainer.Current.Register<IDataExporter>(dataExporter); }