Blame view

netcore/src/Modularity/Common/NCC.Common.Extensions/DemoSettingsOptions.cs 1.04 KB
96009bc9   hexiaodong   hxd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  using Microsoft.Extensions.Configuration;
  using NCC.ConfigurableOptions;
  using System;
  using System.ComponentModel.DataAnnotations;
  
  namespace NCC.Common.Extensions
  {
      /// <summary>
      /// Demo配置选项
      /// </summary>
      public sealed class DemoSettingsOptions : IConfigurableOptions<DemoSettingsOptions>
      {
  
          /// <summary>
          /// 名称
          /// </summary>
          [Required]
          public string AntisSoftName { get; set; }
  
          /// <summary>
          /// 允许Ips
          /// </summary>
          public string[] AllowIps { get; set; }
          /// <summary>
          /// Bool
          /// </summary>
          public bool? AllowDemoBool { get; set; }
  
          /// <summary>
          ///  过期时间
          /// </summary>
          public int? SetPreflightMaxAge { get; set; }
  
  
  
          public void PostConfigure(DemoSettingsOptions options, IConfiguration configuration)
          {
              AntisSoftName ??= "App.AntisSoft";
              AllowIps ??= Array.Empty<string>();
              AllowDemoBool ??= true;
          }
      }
  }