一、配置管理

二、管道

三、认证与授权

四、MVCDemo

五、IdentityServer4

 

 

一、配置管理

1,读取内存配置

using System;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            Dictionary<string, string> dic = new Dictionary<string, string>() {
                { "name","hunter"},
                { "age","10"}
            };

            var builder = new ConfigurationBuilder()
                .AddInMemoryCollection(dic)//当age没有值的时候使用dic里面的值
                .AddCommandLine(args);

            var configuration = builder.Build();

            Console.WriteLine($"name:{configuration["name"]}");
            Console.WriteLine($"age:{configuration["age"]}");

            Console.ReadKey();
        }
    }
}
demo

相关文章:

  • 2022-12-23
  • 2021-08-28
  • 2020-04-25
  • 2019-12-05
  • 2021-09-15
  • 2021-09-21
  • 2021-11-10
  • 2021-06-03
猜你喜欢
  • 2021-05-24
  • 2021-12-22
  • 2019-11-11
  • 2021-10-09
  • 2021-06-05
  • 2022-02-24
  • 2022-12-23
相关资源
相似解决方案