// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "AssetCloudExample", Version = "v1" }); }); var defaultConfig = new AssetCloudConfig { AppKey = Configuration.GetSection("assetcloud:key").Value, AppSecret = Configuration.GetSection("assetcloud:secret").Value, BaseUrl = Configuration.GetSection("assetcloud:url").Value, ThrowsOnFailureResponseCode = true }; Console.WriteLine($"获取到资产云SDK URL: {defaultConfig.BaseUrl}, AppKey: {defaultConfig.AppKey}"); services.AddSingleton(defaultConfig); }
public PersonController(AssetCloudConfig config, ILogger <PersonController> logger) { _logger = logger; client = new AssetCloudClient(config); }