Exemple #1
0
 public TestFixture()
 {
     Host = Hosting.Host.CreateDefaultBuilder()
            .ConfigureServices((hostContext, services) =>
     {
         services.AddBreachedPasswordService();
         services.AddForbiddenPasswordService(hostContext.Configuration);
     })
            .Build();
 }
        public static CommonHosting.IHost EncryptSettings <TSettings>(this CommonHosting.IHost host, bool encrypt, string settingsParamName = AppConstants.DEFAULT_SETTINGS_PARAM_NAME)
            where TSettings : class, new()
        {
            switch (encrypt)
            {
            case true:
                PerformSettingsEncryption <TSettings>(host.Services, settingsParamName);
                break;

            case false:
                PerformSettingsDecryption <TSettings>(host.Services, settingsParamName);
                break;
            }

            return(host);
        }
Exemple #3
0
        public static void CreateDbIfNotExists(Microsoft.Extensions.Hosting.IHost host)
        {
            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                try
                {
                    var context = services.GetRequiredService <HieromemicsContext>();
                    DbInit.Initialize(context);
                }
                catch (Exception ex)
                {
                    var logger = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occured created the DB.");
                }
            }
        }
Exemple #4
0
 public UniversalServiceHost(Microsoft.Extensions.Hosting.IHost host)
 {
     this.m_host = host;
 }