Esempio n. 1
0
 /// <summary>
 /// 将应用程序服务添加到<see cref="IServiceCollection"/>
 /// 检索程序集,查找实现了<see cref="ITransientDependency"/>,<see cref="IScopeDependency"/>,<see cref="ISingletonDependency"/> 接口的所有服务,分别按生命周期类型进行添加
 /// </summary>
 public static IServiceCollection AddAppServices(this IServiceCollection services, AppServiceAdderOptions options = null)
 {
     if (_added)
     {
         throw new InvalidOperationException("services.AddAppServices 扩展方法只能调用1次,不能多次调用。");
     }
     if (options == null)
     {
         options = new AppServiceAdderOptions();
     }
     return(new AppServiceAdder(options).AddServices(services));
 }
Esempio n. 2
0
 /// <summary>
 /// 初始化一个<see cref="AppServiceAdder"/>类型的新实例
 /// </summary>
 public AppServiceAdder(AppServiceAdderOptions options)
 {
     _options = options;
 }