示例#1
0
        public AppWorkFlowWithOptionsSnapshot(IOptionsSnapshot <AppSetting1> appSettingOption,
                                              IOptionsSnapshot <Player1> playerOption)
        {
            this._player     = playerOption?.Value;
            this._appSetting = appSettingOption?.Value;

            Console.WriteLine($"AppSetting.Player.AppId = {this._appSetting.Player.AppId}");
            Console.WriteLine($"Player.AppId = {this._player.AppId}");
        }
        public AppWorkFlowWithOptionsMonitor(IOptionsMonitor <AppSetting1> appSettingOption,
                                             IOptionsMonitor <Player1> playerOption)
        {
            this._player     = playerOption.Get("Player");
            this._appSetting = appSettingOption?.CurrentValue;

            Console.WriteLine($"AppSetting.Player.AppId = {this._appSetting.Player.AppId}");
            Console.WriteLine($"Player.AppId = {this._player.AppId}");
        }
示例#3
0
 public AppWorkFlowWithOption(IOptions <AppSetting1> options)
 {
     try
     {
         this._appSetting = options.Value;
     }
     catch (OptionsValidationException ex)
     {
         foreach (var failure in ex.Failures)
         {
             Console.WriteLine(failure);
         }
     }
 }