Exemplo n.º 1
0
 public DefaultDependencyCacheService(
     BellightCoreOptions options,
     ISerializer serializer,
     IServiceCollection services,
     IServiceProvider serviceProvider)
 {
     _options         = options;
     _serializer      = serializer;
     _serviceProvider = serviceProvider;
     _services        = services;
 }
Exemplo n.º 2
0
 public DefaultAssemblyScanner(
     BellightCoreOptions options,
     IAssemblyLoader assemblyLoader,
     IAssemblyHandler assemblyHandler,
     IEnumerable <ITypeHandler> typeHandlers)
 {
     _assemblyLoader  = assemblyLoader;
     _assemblyHandler = assemblyHandler;
     _options         = options;
     _typeHandlers    = typeHandlers;
 }
        public static IServiceCollection AddBellightCore(this IServiceCollection services, Action <BellightCoreOptions> setupAction)
        {
            var options = new BellightCoreOptions();

            options.AddDependencyHandler();

            setupAction(options);

            Starter.ScanAndRegisterServices(services, options);

            return(services);
        }
 public static BellightCoreOptions AddMediatR(this BellightCoreOptions options)
 {
     return(options.AddStartupServiceAction(startupContainerServices => {
         startupContainerServices.AddTypeHandler <MediatRTypeHandler>();
     }).AddStartupContainerAction((_, services) => {
         services.AddTransient <ServiceFactory>(p => p.GetService);
         services.AddTransient(typeof(IPipelineBehavior <,>), typeof(RequestPreProcessorBehavior <,>));
         services.AddTransient(typeof(IPipelineBehavior <,>), typeof(RequestPostProcessorBehavior <,>));
         services.AddTransient(typeof(IPipelineBehavior <,>), typeof(RequestExceptionActionProcessorBehavior <,>));
         services.AddTransient(typeof(IPipelineBehavior <,>), typeof(RequestExceptionProcessorBehavior <,>));
         services.AddTransient <IMediator, Mediator>();
     }));
 }