public AquariusWeixinBuilder(IServiceCollection services) { _services = services; _provider = services.BuildServiceProvider(); //get an instance of IServiceProvider _options = _provider.GetRequiredService <IOptions <AquariusWeixinOptions> >().Value; //resolve an instance of AquariusWeixinOptions }
/// <summary> /// 添加 Aquarius.Weixin /// </summary> /// <param name="services">The services.</param> /// <param name="configuration">The configuration.</param> /// <returns></returns> public static IServiceCollection AddAquariusWeixin(this IServiceCollection services, IConfiguration configuration) { options = configuration.Get <AquariusWeixinOptions>(); return(services.AddAquariusWeixin()); }