// This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            var exportService = new ExportService(new ExportService.Config
            {
                ReadyDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                              ApplicationRomingFolderName,
                                              "exportReady"),
                WorkingDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                ApplicationRomingFolderName,
                                                "exportPrepare"),
            });

            var persistenceFacade = new PersistenceFacade(persistenceConfig);
            var dbTemplateService = new DBTemplateService(persistenceFacade);

            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_3_0);
            services.AddSingleton <DBTemplateService>(dbTemplateService);
            services.AddSingleton <ExportService>(exportService);
            services.AddSingleton <ExportController>(new ExportController(dbTemplateService, exportService));
            services.AddSingleton <PersistenceFacade>(persistenceFacade);
            services.AddSingleton <DatabaseModelImportService>(new DatabaseModelImportService(new ImporterProxy(), persistenceFacade));
            services.AddLogging();
        }
Пример #2
0
 public ExportController(DBTemplateService dBTemplateService, ExportService exportService)
 {
     if (exportService == null)
     {
         throw new ArgumentNullException(nameof(exportService));
     }
     if (dBTemplateService == null)
     {
         throw new ArgumentNullException(nameof(dBTemplateService));
     }
     this.exportService     = exportService;
     this.dBTemplateService = dBTemplateService;
 }