コード例 #1
0
 public static void RegisterDbDependancies(this IServiceCollection services, ConfigurationSetting configurationSetting)
 {
     services.AddSingleton <IDatabaseContext>(new DatabaseContext(
                                                  configurationSetting.DatabaseSettings.ConnectionString,
                                                  configurationSetting.DatabaseSettings.DatabaseName));
 }
コード例 #2
0
 public static IServiceCollection AddConsulConfig(this IServiceCollection services, ConfigurationSetting configurationSetting)
 {
     services.AddSingleton <IConsulClient, ConsulClient>(p => new ConsulClient(consulConfig =>
     {
         consulConfig.Address = new Uri(configurationSetting.ConsulAddresss);
     }));
     return(services);
 }