/// <summary> /// 配置服务方法。 /// </summary> /// <param name="builder">容器构建实例。</param> public void ConfigureServices(IServiceBuilder builder) { builder.AddTaskServices(); builder.AddScoped(ss => ss.GetRequiredService <ISettingsManager>().GetSettings <SiteSettings>()); }
/// <summary> /// 添加服务。 /// </summary> /// <param name="builder">服务构建实例。</param> public void ConfigureServices(IServiceBuilder builder) { builder.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); builder.AddScoped(services => services.GetRequiredService <IUserManager>().GetUser() ?? new User { }); }