Example #1
0
 public static Bootstrapper AddPipelines <TParent>(this Bootstrapper bootstrapper) =>
 bootstrapper.ConfigureServices(x =>
 {
     foreach (Type pipelineType in typeof(TParent).GetNestedTypes().Where(t => typeof(IPipeline).IsAssignableFrom(t)))
     {
         x.AddSingleton(typeof(IPipeline), pipelineType);
     }
 });
Example #2
0
 public static Bootstrapper AddPipeline(this Bootstrapper bootstrapper, Type pipelineType)
 {
     _ = pipelineType ?? throw new ArgumentNullException(nameof(pipelineType));
     if (!typeof(IPipeline).IsAssignableFrom(pipelineType))
     {
         throw new ArgumentException("Provided type is not a pipeline");
     }
     return(bootstrapper.ConfigureServices(x => x.AddSingleton(typeof(IPipeline), pipelineType)));
 }
Example #3
0
 public static Bootstrapper AddPipelines(this Bootstrapper bootstrapper, Assembly assembly)
 {
     _ = assembly ?? throw new ArgumentNullException(nameof(assembly));
     return(bootstrapper.ConfigureServices(x =>
     {
         foreach (Type pipelineType in bootstrapper.ClassCatalog.GetTypesAssignableTo <IPipeline>().Where(x => x.Assembly.Equals(assembly)))
         {
             x.AddSingleton(typeof(IPipeline), pipelineType);
         }
     }));
 }
Example #4
0
 public static Bootstrapper AddDefaultLogging(this Bootstrapper bootstrapper) =>
 bootstrapper.ConfigureServices(services =>
 {
     services.AddSingleton <ILoggerProvider, ConsoleLoggerProvider>();
     services.AddLogging(logging => logging.AddDebug());
 });
 public static Bootstrapper AddPipeline <TPipeline>(this Bootstrapper bootstrapper)
     where TPipeline : IPipeline =>
 bootstrapper.ConfigureServices(x => x.AddSingleton(typeof(IPipeline), typeof(TPipeline)));