Example #1
0
        private void Register(IServiceRegistrar adapter)
        {
            adapter.RegisterInstance <RouteCollection>(RouteTable.Routes)
            .RegisterInstance <IBuildManager>(BuildManager)
            .RegisterAsSingleton <IFilterRegistry, FilterRegistry>()
            .RegisterAsSingleton <IModelMetadataRegistry, ModelMetadataRegistry>();

            BuildManager.ConcreteTypes
            .Where(type => KnownTypes.BootstrapperTaskType.IsAssignableFrom(type))
            .Each(type => adapter.RegisterAsSingleton(type));

            BuildManager.ConcreteTypes
            .Where(type => KnownTypes.PerRequestTaskType.IsAssignableFrom(type))
            .Each(type => adapter.RegisterAsPerRequest(type));

            adapter.RegisterInstance <IServiceRegistrar>(adapter)
            .RegisterInstance <IDependencyResolver>(adapter)
            .RegisterInstance <IServiceInjector>(adapter)
            .RegisterInstance <ContainerAdapter>(adapter)
            .RegisterInstance <IBootstrapperTasksRegistry>(BootstrapperTasks)
            .RegisterInstance <IPerRequestTasksRegistry>(PerRequestTasks)
            .RegisterInstance <TypeMappingRegistry <Controller, IActionInvoker> >(new TypeMappingRegistry <Controller, IActionInvoker>())
            .RegisterInstance <TypeMappingRegistry <Controller, IControllerActivator> >(new TypeMappingRegistry <Controller, IControllerActivator>())
            .RegisterInstance <TypeMappingRegistry <IView, IViewPageActivator> >(new TypeMappingRegistry <IView, IViewPageActivator>())
            .RegisterInstance <TypeMappingRegistry <object, IModelBinder> >(new TypeMappingRegistry <object, IModelBinder>());
        }
Example #2
0
        public StorageBuilder(Storage storage = null) : base(storage)
        {
            ServicesGenerator = new ServicesGenerator(new TypeIsClassValidator(), new ImplementationsFinder(new TypeImplementsInterfaceValidator()),
                                                      new ServiceGenerator(
                                                          new ServiceFlagsGenerator(new ServiceFlagsProvider(new AttributesFinder(), new MemberGenerator(new MemberFlagsGenerator())),
                                                                                    new ServiceFlagsIssuesResolver()),
                                                          new ServiceRegistrationGenerator(new ServiceRegistrationFlagGenerator(new BaseTypeFinder(), new ServiceRegistrationInterfacesGenerator(new RegistrationInterfacesFilter(new NamespaceInterfaceValidator()), new TypeContainsGenericParametersChecker(), new TypeGenericParametersProvider(), new InterfaceGenerator(new TypeGenericParametersProvider(), new TypeContainsGenericParametersChecker())), new ConstructorGenerator(new ParametersGenerator(new ParameterGenerator())), new ConstructorInfoListGenerator(), new DefaultConstructorInfoProvider())),
                                                          new ServiceInfoGenerator(), new ClassHasServiceFactoryChecker(),
                                                          new ServiceFactoryProvider(new InstancesCreator(new ConstructorInstanceCreator(new ConstructorInvoker(),
                                                                                                                                         new ConstructorParametersGenerator(new TypedMemberValueProvider(), new ConstructorParameterByTypeFinder(),
                                                                                                                                                                            new ServiceHasConstructorParametersChecker()),
                                                                                                                                         new ConstructorProvider(new ConstructorChecker(), new DefaultConstructorProvider(),
                                                                                                                                                                 new ConstructorGenerator(new ParametersGenerator(new ParameterGenerator()))), new ConstructorInfoListGenerator(),
                                                                                                                                         new ConstructorFinder(), new ConstructorListGenerator(new ConstructorGenerator(new ParametersGenerator(new ParameterGenerator()))),
                                                                                                                                         new ParametersValuesExtractor()))), new ServiceFactoryInvoker()));

            ServiceRegistrar = new ServiceRegistrar(
                new ServiceInstanceProvider(
                    new InstancesCreator(new ConstructorInstanceCreator(new ConstructorInvoker(),
                                                                        new ConstructorParametersGenerator(new TypedMemberValueProvider(), new ConstructorParameterByTypeFinder(),
                                                                                                           new ServiceHasConstructorParametersChecker()),
                                                                        new ConstructorProvider(new ConstructorChecker(), new DefaultConstructorProvider(),
                                                                                                new ConstructorGenerator(new ParametersGenerator(new ParameterGenerator()))), new ConstructorInfoListGenerator(),
                                                                        new ConstructorFinder(), new ConstructorListGenerator(new ConstructorGenerator(new ParametersGenerator(new ParameterGenerator()))),
                                                                        new ParametersValuesExtractor())), new ServiceIsAutoValueChecker()), new ServiceInstanceChecker(), new RegistratedServicesFilter());

            AssemblyRegistrar = new AssemblyRegistrar(new AssemblyListAdder(), new AssemblyListContainsChecker());

            ConstructorParametersGenerator = new ConstructorParametersByObjectsGenerator(new TypeGetter());
        }
Example #3
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="serviceRegistrar">Сервис для работы с архивом</param>
 /// <param name="service1C">Сервис 1С</param>
 /// <param name="secret1C">Данные для подключения</param>
 /// <param name="logger">Логгер</param>
 public RegistrarDepartmentReportController(IServiceRegistrar serviceRegistrar, IService1СSoap service1C,
                                            ISecret1C secret1C, ILogger <RegistrarDepartmentReportController> logger)
 {
     _ServiceRegistrar = serviceRegistrar;
     _Service1C        = service1C;
     _Secret1C         = secret1C;
     _Logger           = logger;
 }
Example #4
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="service1C">Сервис 1С</param>
 /// <param name="serviceRegistrar">Сервис по работе с документами</param>
 /// <param name="secret1Cs">Данные для подключения</param>
 /// <param name="logger">Логгер</param>
 public RegistrarDocumentsController(IService1СSoap service1C, IServiceRegistrar serviceRegistrar,
                                     ISecret1C secret1Cs, ILogger <RegistrarDocumentsController> logger)
 {
     _ServiceRegistrar = serviceRegistrar;
     _Service1C        = service1C;
     _Secret1Cs        = secret1Cs;
     _Logger           = logger;
 }
        /// <summary>
        /// Registers all request handlers.
        /// </summary>
        /// <param name="serviceRegistrar">  The service registrar. </param>
        /// <param name="registrationScope"> The registration scope. </param>
        /// <param name="assembliesToScan">  The assemblies to scan. </param>
        /// <returns>  </returns>
        public static IServiceRegistrar RegisterAllRequestHandlers(this IServiceRegistrar serviceRegistrar, RegistrationScope registrationScope, IEnumerable <Assembly> assembliesToScan)
        {
            assembliesToScan  = (assembliesToScan as Assembly[] ?? assembliesToScan).Distinct().ToArray();
            registrationScope = RegistrationScope.Singleton.Restricted(registrationScope);

            return(serviceRegistrar
                   .ConnectImplementationsToTypesClosing(registrationScope, typeof(IRequestHandler <,>), assembliesToScan, false));
        }
Example #6
0
        public void Register(IServiceRegistrar registrar)
        {
            if (registrar == null)
            {
                throw new ArgumentNullException(nameof(registrar));
            }

            registrars.Add(registrar);
        }
Example #7
0
        /// <summary>
        /// Registers the by I service registration.
        /// </summary>
        /// <param name="registrar">The registrar.</param>
        /// <param name="predicate">The predicate.</param>
        /// <param name="assemblies">The assemblies.</param>
        public static void RegisterByIServiceRegistration(this IServiceRegistrar registrar, Predicate <Type> predicate, params Assembly[] assemblies)
        {
            if (registrar == null)
            {
                throw new ArgumentNullException("registrar");
            }
            var debugger = ServiceLocatorManager.Debugger;

            if (debugger == null || (debugger.Flags & ServiceLocatorManagerDebugger.DebuggerFlags.ByIServiceRegistration) != ServiceLocatorManagerDebugger.DebuggerFlags.ByIServiceRegistration)
            {
                if (assemblies == null || assemblies.Count() == 0)
                {
                    return;
                }
                var locator          = registrar.Locator;
                var registrationType = typeof(IServiceRegistrant);
                var matchedTypes     = assemblies.SelectMany(a => a.AsConcreteTypes(registrationType, predicate))
                                       .Where(t => !ServiceLocatorManager.HasIgnoreServiceLocator(t));
                foreach (var matchedType in matchedTypes)
                {
                    locator.Resolve <IServiceRegistrant>(matchedType).Register(registrar);
                }
            }
            else
            {
                var log = debugger.Log;
                log.Information("RegisterByIServiceRegistration");
                if (assemblies == null || assemblies.Count() == 0)
                {
                    log.Information("Done. No assemblies requested.");
                    return;
                }
                var locator          = registrar.Locator;
                var registrationType = typeof(IServiceRegistrant);
                var matchedTypes     = assemblies.SelectMany(a =>
                {
                    log.InformationFormat("- Scanning assembly {0}:", a.FullName);
                    return(a.AsConcreteTypes(registrationType, predicate));
                })
                                       .Where(t =>
                {
                    if (!ServiceLocatorManager.HasIgnoreServiceLocator(t))
                    {
                        return(true);
                    }
                    log.InformationFormat("- {0} HasIgnoreServiceLocator and has been skipped.", t.FullName);
                    return(false);
                });
                foreach (var matchedType in matchedTypes)
                {
                    log.InformationFormat("- {0} Matching Type.", matchedType.FullName);
                    locator.Resolve <IServiceRegistrant>(matchedType).Register(registrar);
                }
                log.Information("Done.");
            }
        }
Example #8
0
        public void Bootstrap(IServiceRegistrar registrar)
        {
            registrar.Register <ITextLogFormatter, TextLogFormatter>();
            registrar.RegisterSingleton <IClock, SystemClock>();
            registrar.RegisterSingleton <IApplicationOptions, ApplicationOptions>();
            registrar.RegisterSingleton <ILogger, Logger>();

            if (Debugger.IsAttached)
            {
                registrar.RegisterSingleton <ILogDestination, DebugLogDestination>();
            }
        }
Example #9
0
        public ReadOnlyContainer(IStorage storage, IServiceFinder serviceFinder, ITypeGetter typeGetter, IServiceInstanceResolver serviceInstanceResolver,
                                 IAssemblyRegistrar assemblyRegistrar, IServiceRegistrar serviceRegistrar, IServicesGenerator servicesGenerator)
        {
            ServiceFinder           = serviceFinder;
            TypeGetter              = typeGetter;
            ServiceInstanceResolver = serviceInstanceResolver;
            AssemblyRegistrar       = assemblyRegistrar;
            ServiceRegistrar        = serviceRegistrar;
            ServicesGenerator       = servicesGenerator;

            Storage = storage;
        }
Example #10
0
        public static IServiceRegistrar Bootstrap <T>([NotNull] this IServiceRegistrar registrar)
            where T : IServicesBootstrapper, new()
        {
            if (registrar == null)
            {
                throw new ArgumentNullException(nameof(registrar));
            }

            var bootstrapper = new T();

            bootstrapper.Bootstrap(registrar);
            return(registrar);
        }
Example #11
0
 public MyClass(IServiceRegistrar registrar)
 {
     // register as a type mapping
     registrar.Register <IMyService, MyService>();
     // register as a single instance
     registrar.RegisterInstance <IMyService>(new MyService {
         Value = "Value"
     });
     // register as a delegate
     registrar.Register <IMyService>(locator => new MyService {
         Value = "Value"
     });
 }
Example #12
0
 public ServiceLocatorNamespaceBehaviorWrapper(IServiceLocator parent, string @namespace)
 {
     if (parent == null)
     {
         throw new ArgumentNullException("parent");
     }
     if (string.IsNullOrEmpty(@namespace))
     {
         throw new ArgumentNullException("@namespace");
     }
     _parent    = parent;
     _namespace = @namespace;
     _registrar = new ServiceRegistrarNamespaceBehaviorWrapper(this, _parent.Registrar, @namespace);
 }
Example #13
0
        public void Bootstrap(IServiceRegistrar registrar)
        {
            registrar.Register <IGameEngine, GameEngine>();
            registrar.Register <IDeckCreator, DeckCreator>();

            registrar.Register <ISystem, CardDetailsProviderSystem>();
            registrar.Register <ISystem, CardPreparationSystem>();

            registrar.Register <ISystem, PowerSystem>();
            registrar.Register <ISystem, ToughnessSystem>();

            registrar.Register <ISystem, ZombiesGainsPlusOnePlusOneCounterSystem>();
            registrar.Register <ISystem, CreatureKilledSystem>();
        }
        public static void WithEFCoreOutbox <T>(this IServiceRegistrar services,
                                                Action <EFCoreOutbox.OutboxSettings> config
                                                ) where T : DbContext
        {
            OutboxSettings settings = new OutboxSettings();

            if (config != null)
            {
                config.Invoke(settings);
            }
            services.AddSingleton <OutboxSettings>(settings);
            services.AddSingleton <IOutbox, Outbox <T> >(true);
            services.AddTransient <IOutboxSession, OutboxSession <T> >();
        }
Example #15
0
 public Container(IStorage storage, IServiceRegistrar serviceRegistrar, IServicesGenerator servicesGenerator, IServiceFinder serviceFinder,
                  IServiceInitializer serviceInitializer, ITypeExisterChecker typeExisterChecker, IServiceIsAutoValueChecker serviceIsAutoValueChecker,
                  ITypeGetter typeGetter, IAssemblyRegistrar assemblyRegistrar, IConstructorParametersByObjectsGenerator constructorParametersByObjectsGenerator,
                  IServiceInstanceResolver serviceInstanceResolver) : base(storage, serviceFinder, typeGetter, serviceInstanceResolver, assemblyRegistrar, serviceRegistrar, servicesGenerator)
 {
     ServicesGenerator         = servicesGenerator;
     ServiceFinder             = serviceFinder;
     ServiceInitializer        = serviceInitializer;
     ServiceIsAutoValueChecker = serviceIsAutoValueChecker;
     ConstructorParametersByObjectsGenerator = constructorParametersByObjectsGenerator;
     TypeGetter              = typeGetter;
     AssemblyRegistrar       = assemblyRegistrar;
     ServiceInstanceResolver = serviceInstanceResolver;
 }
 private static void AddConcretionsThatCouldBeClosed(this IServiceRegistrar serviceRegistrar, RegistrationScope registrationScope, Type @interface, List <Type> concretions)
 {
     foreach (var type in concretions
              .Where(x => x.IsOpenGeneric() && x.CouldCloseTo(@interface)))
     {
         try
         {
             serviceRegistrar.Register(@interface, type.MakeGenericType(@interface.GenericTypeArguments), registrationScope);
         }
         catch (Exception)
         {
         }
     }
 }
Example #17
0
        public static void RegisterBuilders(IServiceRegistrar serviceRegistrar, params Assembly[] assemblies)
        {
            var queryBuilderType  = typeof(QueryBuilder <>);
            var assemblyTypes     = assemblies.SelectMany(a => a.GetTypes()).ToList();
            var queryBuilderTypes = assemblyTypes
                                    .Where(t => !t.IsAbstract && !t.IsInterface)
                                    .Where(t => t.BaseType.IsGenericType && t.BaseType.GetGenericTypeDefinition() == queryBuilderType)
                                    .ToList();

            foreach (var builderType in queryBuilderTypes)
            {
                serviceRegistrar.Register(typeof(IQueryBuilder <>).MakeGenericType(builderType.BaseType.GetGenericArguments().First()), builderType);
            }
        }
        public static void RegisterListeners(IServiceRegistrar serviceRegistrar, params Assembly[] assemblies)
        {
            var eventListenerType  = typeof(EventListener <>);
            var assemblyTypes      = assemblies.SelectMany(a => a.GetTypes()).ToList();
            var eventListenerTypes = assemblyTypes
                                     .Where(t => !t.IsAbstract && !t.IsInterface)
                                     .Where(t => t.BaseType.IsGenericType && t.BaseType.GetGenericTypeDefinition() == eventListenerType)
                                     .GroupBy(t => t.BaseType.GetGenericArguments().First())
                                     .ToList();

            foreach (var events in eventListenerTypes)
            {
                foreach (var listener in events)
                {
                    serviceRegistrar.Register(typeof(IEventListener <>).MakeGenericType(events.Key), listener);
                }
            }
        }
        private static IServiceRegistrar Register(this IServiceRegistrar serviceRegistrar, Type serviceType, Type implementationType, RegistrationScope registrationScope)
        {
            switch (registrationScope)
            {
            case RegistrationScope.Singleton:
                return(serviceRegistrar.AddSingleton(serviceType, implementationType));

            case RegistrationScope.Scoped:
                return(serviceRegistrar.AddScoped(serviceType, implementationType));

            case RegistrationScope.Transient:
                return(serviceRegistrar.AddTransient(serviceType, implementationType));

            default:
                break;
            }

            return(serviceRegistrar);
        }
        /// <summary>
        /// Behaves as.
        /// </summary>
        /// <param name="registrar">The registrar.</param>
        /// <param name="farm">The farm.</param>
        /// <returns></returns>
        public static IServiceRegistrar BehaveAs(this IServiceRegistrar registrar, SPFarm farm)
        {
            if (registrar == null)
            {
                throw new ArgumentNullException("registrar");
            }
            var registrarAsCloneable = (registrar as ICloneable);

            if (registrarAsCloneable == null)
            {
                throw new ArgumentNullException("registrar", "Provider must have ICloneable");
            }
            var newRegistrar           = (IServiceRegistrar)registrarAsCloneable.Clone();
            var newRegistrarAsAccessor = (newRegistrar as ISPServiceBehaviorAccessor);

            if (newRegistrarAsAccessor == null)
            {
                throw new ArgumentNullException("registrar", "Provider must have ISPServiceBehaviorAccessor");
            }
            newRegistrarAsAccessor.SetContainerAsFarm();
            return(newRegistrar);
        }
Example #21
0
        /// <summary>
        /// Behaves as.
        /// </summary>
        /// <param name="registrar">The registrar.</param>
        /// <param name="lifetime">The lifetime.</param>
        /// <returns></returns>
        public static IServiceRegistrar BehaveAs(this IServiceRegistrar registrar, ServiceRegistrarLifetime lifetime)
        {
            if (registrar == null)
            {
                throw new ArgumentNullException("registrar");
            }
            var registrarAsCloneable = (registrar as ICloneable);

            if (registrarAsCloneable == null)
            {
                throw new ArgumentNullException("registrar", "Provider must have ICloneable");
            }
            var newRegistrar           = (IServiceRegistrar)registrarAsCloneable.Clone();
            var newRegistrarAsAccessor = (newRegistrar as IServiceRegistrarBehaviorAccessor);

            if (newRegistrarAsAccessor == null)
            {
                throw new ArgumentNullException("registrar", "Provider must have IServiceRegistrarBehaviorAccessor");
            }
            newRegistrarAsAccessor.Lifetime = lifetime;
            return((IServiceRegistrar)newRegistrar);
        }
Example #22
0
        public static void RegisterRepositories(IServiceRegistrar serviceRegistrar, params Assembly[] assemblies)
        {
            var assemblyTypes   = assemblies.SelectMany(a => a.GetTypes()).ToList();
            var repositoryTypes = assemblyTypes
                                  .Where(t => t.IsInterface)
                                  .Where(t => t.GetInterfaces()
                                         .Any(i => i == typeof(IReadRepository) ||
                                              (i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IWriteRepository <>)))
                                         )
                                  .ToList();
            var repositories = assemblyTypes
                               .Where(t => !t.IsAbstract && !t.IsInterface && t.GetInterfaces().Any(i => repositoryTypes.Contains(i)))
                               .ToList();

            foreach (var repositoryType in repositories)
            {
                var implementedRepositories = repositoryType.GetInterfaces().Where(i => repositoryTypes.Contains(i));
                foreach (var implementedRepository in implementedRepositories)
                {
                    serviceRegistrar.Register(implementedRepository, repositoryType);
                }
            }
        }
Example #23
0
        public static void RegisterHandlers(IServiceRegistrar serviceRegistrar, params Assembly[] assemblies)
        {
            var commandHandlerTypes = new[]
            {
                typeof(CommandHandler <>),
                typeof(CommandHandler <,>),
                typeof(CommandHandler <, ,>),
                typeof(CommandHandler <, , ,>)
            };
            var assemblyTypes   = assemblies.SelectMany(a => a.GetTypes()).ToList();
            var commandHandlers = assemblyTypes
                                  .Where(t => !t.IsAbstract && !t.IsInterface)
                                  .Where(t => t.BaseType.IsGenericType && commandHandlerTypes.Any(ct => t.BaseType.GetGenericTypeDefinition() == ct))
                                  .ToList();

            foreach (var handlerType in commandHandlers)
            {
                var commandTypes = handlerType.BaseType.GenericTypeArguments.ToList();
                foreach (var commandType in commandTypes)
                {
                    serviceRegistrar.Register(typeof(ICommandHandler <>).MakeGenericType(commandType), handlerType);
                }
            }
        }
 public void Initialize()
 {
     Locator   = CreateServiceLocator();
     Registrar = Locator.Registrar;
     RegisterForTests();
 }
 /// <summary>
 /// Registers the default mediator.
 /// </summary>
 /// <param name="serviceRegistrar">  The service registrar. </param>
 /// <param name="registrationScope"> The registration scope. </param>
 /// <returns> The <see cref="IServiceRegistrar" /> </returns>
 public static IServiceRegistrar RegisterDefaultMediator(this IServiceRegistrar serviceRegistrar, RegistrationScope registrationScope)
 {
     registrationScope = RegistrationScope.Singleton.Restricted(registrationScope);
     return(serviceRegistrar
            .Register <IMediator, Mediator>(registrationScope));
 }
 /// <summary>
 /// Registers all request handlers.
 /// </summary>
 /// <param name="serviceRegistrar">  The service registrar. </param>
 /// <param name="registrationScope"> The registration scope. </param>
 /// <param name="assembliesToScan">  The assemblies to scan. </param>
 /// <returns>  </returns>
 public static IServiceRegistrar RegisterAllRequestHandlers(this IServiceRegistrar serviceRegistrar, RegistrationScope registrationScope, params Assembly[] assembliesToScan)
 => serviceRegistrar.RegisterAllRequestHandlers(registrationScope, assembliesToScan.AsEnumerable());
 private static IServiceRegistrar Register <TService, TImplementation>(this IServiceRegistrar serviceRegistrar, RegistrationScope registrationScope) where TImplementation : TService
 => serviceRegistrar.Register(typeof(TService), typeof(TImplementation), registrationScope);
        /// <summary>
        /// Helper method use to differentiate behavior between request handlers and notification
        /// handlers. Request handlers should only be added once (so set addIfAlreadyExists to false)
        /// Notification handlers should all be added (set addIfAlreadyExists to true)
        /// </summary>
        /// <param name="serviceRegistrar">      </param>
        /// <param name="registrationScope">     </param>
        /// <param name="openRequestInterface">  </param>
        /// <param name="assembliesToScan">      </param>
        /// <param name="addIfAlreadyExists">    </param>
        private static IServiceRegistrar ConnectImplementationsToTypesClosing(this IServiceRegistrar serviceRegistrar,
                                                                              RegistrationScope registrationScope,
                                                                              Type openRequestInterface,
                                                                              IEnumerable <Assembly> assembliesToScan,
                                                                              bool addIfAlreadyExists)
        {
            if (!assembliesToScan.Any())
            {
                assembliesToScan = AppDomain.CurrentDomain.GetAssemblies();
            }

            var concretions = new List <Type>();
            var interfaces  = new List <Type>();

            foreach (var type in assembliesToScan.SelectMany(a => a.DefinedTypes).Where(t => !t.IsOpenGeneric()))
            {
                var interfaceTypes = Enumerable.ToArray <Type>(type.FindInterfacesThatClose(openRequestInterface));
                if (!interfaceTypes.Any())
                {
                    continue;
                }

                if (type.IsConcrete())
                {
                    concretions.Add(type);
                }

                foreach (var interfaceType in interfaceTypes)
                {
                    interfaces.Fill(interfaceType);
                }
            }

            foreach (var @interface in interfaces)
            {
                var exactMatches = concretions.Where(x => x.CanBeCastTo(@interface)).ToList();
                if (addIfAlreadyExists)
                {
                    foreach (var type in exactMatches)
                    {
                        serviceRegistrar.Register(@interface, type, registrationScope);
                    }
                }
                else
                {
                    if (exactMatches.Count > 1)
                    {
                        exactMatches.RemoveAll(m => !IsMatchingWithInterface(m, @interface));
                    }

                    foreach (var type in exactMatches)
                    {
                        serviceRegistrar.Register(@interface, type, registrationScope);
                    }
                }

                if ([email protected]())
                {
                    serviceRegistrar.AddConcretionsThatCouldBeClosed(registrationScope, @interface, concretions);
                }
            }

            return(serviceRegistrar);
        }
Example #29
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 /// <param name="serviceRegistrar">Сервис для работы с хранилищем</param>
 /// <param name="logger">Логгер</param>
 public PhotoApi(IServiceRegistrar serviceRegistrar, ILogger <PhotoApi> logger)
 {
     _ServiceRegistrar = serviceRegistrar;
     _Logger           = logger;
 }
Example #30
0
 public virtual AppSection Configure(IServiceRegistrar r)
 {
     r.RegisterInstance <AppSection>(this);
     return(this);
 }
Example #31
0
 public virtual HostingSection Configure(IServiceRegistrar r)
 {
     r.RegisterInstance<HostingSection>(this);
     return this;
 }