예제 #1
0
        private async void SeedInstallationForms(IServiceCollection serviceCollection)
        {
            var serviceProvider = serviceCollection.BuildServiceProvider();
            var pluginDbOptions = serviceProvider.GetRequiredService <IPluginDbOptions <InstallationCheckingBaseSettings> >();

            var core = await serviceProvider.GetRequiredService <IEFormCoreService>().GetCore();

            var context = serviceProvider.GetRequiredService <InstallationCheckingPnDbContext>();

            if (string.IsNullOrEmpty(pluginDbOptions.Value.InstallationFormId))
            {
                var installationFormId = await SeedHelper.CreateInstallationForm(core);

                await pluginDbOptions.UpdateDb(settings => settings.InstallationFormId = installationFormId.ToString(), context, 1);
            }

            if (string.IsNullOrEmpty(pluginDbOptions.Value.RemovalFormId))
            {
                var removalFormId = await SeedHelper.CreateRemovalForm(core);

                await pluginDbOptions.UpdateDb(settings => settings.RemovalFormId = removalFormId.ToString(), context, 1);
            }
        }