public static void ConfigureContainer(TinyIoCContainer container)
        {
            var opts = container.Resolve <Options>();

            container.Register(typeof(ILogHandler), typeof(Logger.Log4NetLogger)).AsSingleton();
            container.Register <InMemorySessionManager>().AsSingleton();

            var sessionManager = container.Resolve <InMemorySessionManager>();

            container.Register <ISessionHandler, InMemorySessionManager>(sessionManager);

            container.RegisterMultiple <IMessageLifecycleCallbackHandler>(new List <Type>()
            {
                typeof(SessionMessageLifecycleCallback),
                typeof(SpamManager)
            }).AsSingleton();

            IPAddress ipAddress;

            if (IPAddress.TryParse(opts.IPAddress, out ipAddress) == false)
            {
                throw new ArgumentException("Failed to parse IP Address: " + opts.IPAddress);
            }

            container.Register(typeof(TorqueMasterServer),
                               new TorqueMasterServer(container, new IPEndPoint(ipAddress, opts.Port)));
        }
예제 #2
0
        public static TinyIoCContainer RegisterServices(this TinyIoCContainer container, IAppConfiguration appConfiguration)
        {
            container.Register <RoleService, RoleService>();
            container.Register <UserService, UserService>();
            container.Register <PermissionService, PermissionService>();
            container.Register <GroupService, GroupService>();
            container.Register <ClientService, ClientService>();
            container.Register <GrainService, GrainService>();
            container.Register <SecurableItemService, SecurableItemService>();
            container.Register <MemberSearchService, MemberSearchService>();
            container.Register <GroupMigratorService, GroupMigratorService>();
            container.Register <IIdentityServiceProvider, IdentityServiceProvider>();
            container.Register <IPermissionResolverService, PermissionResolverService>();
            container.RegisterMultiple <IPermissionResolverService>(new List <Type>
            {
                typeof(GranularPermissionResolverService),
                typeof(RolePermissionResolverService),
                typeof(SharedGrainPermissionResolverService)
            });

            container.Register <IEventService, EventService>();
            container.Register <IEventContextResolverService, EventContextResolverService>();
            RegisterEDWAdminRoleSyncService(container);

            return(container);
        }
예제 #3
0
        private void UpdateContainerFromBuilder(TinyIoCContainer _container, DefaultDependencyBuilder b)
        {
            var groupedRegistrations = b.Registrations.SelectMany(r => r.RegistrationTypes.Select(contract => new { registration = r, contract = contract })).GroupBy(r => r.contract).ToArray();

            foreach (var r in groupedRegistrations)
            {
                if (r.Count() > 1)
                {
                    _container.RegisterMultiple(r.Key, r.Select(a => a.registration.SelfType));
                }
                else
                {
                    var registration     = r.First();
                    var registrationType = registration.registration.GetType().GetGenericTypeDefinition();
                    var t = registration.registration.GetType().GetGenericArguments()[0];

                    if (TranslateInstanceRegistration(_container, registration.registration, t))
                    {
                    }
                    else if (TranslateConstructorRegistration(_container, registration.registration, t))
                    {
                    }
                    else if (TranslateFactoryRegistration(_container, registration.registration, t))
                    {
                    }
                }
            }
        }
예제 #4
0
        public static void ConfigureContainer(TinyIoCContainer container)
        {
            var opts = container.Resolve<Options>();

            container.Register(typeof(ILogHandler), typeof(Logger.Log4NetLogger)).AsSingleton();
            container.Register<InMemorySessionManager>().AsSingleton();

            var sessionManager = container.Resolve<InMemorySessionManager>();
            container.Register<ISessionHandler, InMemorySessionManager>(sessionManager);

            container.RegisterMultiple<IMessageLifecycleCallbackHandler>(new List<Type>()
            {
                typeof (SessionMessageLifecycleCallback),
                typeof (SpamManager)
            }).AsSingleton();

            IPAddress ipAddress;

            if (IPAddress.TryParse(opts.IPAddress, out ipAddress) == false)
            {
                throw new ArgumentException("Failed to parse IP Address: " + opts.IPAddress);
            }

            container.Register(typeof(TorqueMasterServer),
                new TorqueMasterServer(container, new IPEndPoint(ipAddress, opts.Port)));
        }
예제 #5
0
        private static void Initialize(IDestination destination, IBootstrapper bootstrapper)
        {
            TinyIoCContainer container = new TinyIoCContainer();
            NoomResolver     resolver  = new NoomResolver(container);

            NoomCache  cache  = new NoomCache();
            NoomTools  tools  = new NoomTools(resolver, cache);
            NoomRouter router = new NoomRouter();

            NoomNavigator navigator = new NoomNavigator(router, destination, tools);

            container.Register <ICache>(cache);
            container.Register <IRouter>(router);
            container.Register <INavigator>(navigator);
            container.Register <IResolver>(resolver);
            container.RegisterMultiple(typeof(IModule), bootstrapper.FindAllModules());

            foreach (Type type in bootstrapper.FindAllViews())
            {
                container.Register(type);
            }

            foreach (IModule module in container.ResolveAll <IModule>())
            {
                module.Register(router);
            }

            navigator.NavigateTo("/");
        }
예제 #6
0
 protected override void ConfigureApplicationContainer(TinyIoCContainer container)
 {
     base.ConfigureApplicationContainer(container);
     container.Register(_solution);
     container.Register(_fileSystem);
     container.RegisterMultiple<IReferenceProcessor>(new []{typeof(AddProjectReferenceProcessor), typeof(AddFileReferenceProcessor), typeof(AddGacReferenceProcessor)});
 }
예제 #7
0
 protected override void ConfigureApplicationContainer(TinyIoCContainer container)
 {
     base.ConfigureApplicationContainer(container);
     container.Register(_solution);
     container.Register(_fileSystem);
     container.RegisterMultiple <IReferenceProcessor>(new [] { typeof(AddProjectReferenceProcessor), typeof(AddFileReferenceProcessor), typeof(AddGacReferenceProcessor) });
 }
        protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context)
        {
            container.Register <IActiveDirectoryProxy, ActiveDirectoryProxy>();
            ICollection <Type> activeDirectoryProviderTypes = new List <Type>();

            if (_appConfig.UseWindowsAuthentication)
            {
                activeDirectoryProviderTypes.Add(typeof(ActiveDirectoryProviderService));
            }

            if (_appConfig.UseAzureAuthentication)
            {
                activeDirectoryProviderTypes.Add(typeof(AzureDirectoryProviderService));
            }

            container.RegisterMultiple <IExternalIdentityProviderService>(activeDirectoryProviderTypes);
            container.Register <PrincipalSearchService, PrincipalSearchService>();
            container.Register <IMicrosoftGraphApi, MicrosoftGraphApi>();

            container.Register <IAzureActiveDirectoryClientCredentialsService, AzureActiveDirectoryClientCredentialsService>("inner");
            container.Register <IAzureActiveDirectoryClientCredentialsService>(
                (c, p) => c.Resolve <AzureActiveDirectoryCacheService>(new NamedParameterOverloads
            {
                { "innerCredentialService", c.Resolve <IAzureActiveDirectoryClientCredentialsService>("inner") }
            }));
        }
예제 #9
0
        public static void ConfigureContainer(TinyIoCContainer container)
        {
            container.Register(typeof(ILogHandler), typeof(Logger.Log4NetLogger)).AsSingleton();
            container.Register(typeof(IMessageRouter<IMessage>), typeof(MessageRouter)).AsSingleton();

            container.RegisterMultiple<IClientLifecycleCallbackHandler>(new List<Type>()
            {
                typeof (BlyncLightManager),
                typeof (SkypeManager)

            }).AsSingleton();

            container.RegisterMultiple<IBlyncLightBehaviour>(new List<Type>()
            {
                typeof (SkypeStatusResponder),
                typeof (BlyncLightScheduler)
            });

            container.RegisterMultiple<ISkypeBehaviour>(new List<Type>()
            {
                typeof (CallStatusNotifier),
                typeof (UserStatusNotifier),
                typeof (OnBreakBehaviour),
                typeof (OnLunchBehaviour),
                typeof (OnCallBehaviour)
            });

            //IBlyncLightBehaviour
            container.Register(typeof(SkypeStatusResponder),
                new SkypeStatusResponder(container.Resolve<IMessageRouter<IMessage>>()));

            //IClientLifecycleCallbackHandler
            container.Register(typeof(SkypeManager),
                new SkypeManager(container.Resolve<ILogHandler>(),
                    container.Resolve<IMessageRouter<IMessage>>(),
                    container.ResolveAll<ISkypeBehaviour>().OrderByDescending(s => s.Priority).ToList()));

            container.Register(typeof(BlyncLightManager),
                new BlyncLightManager(container.Resolve<ILogHandler>(),
                    container.Resolve<IMessageRouter<IMessage>>(),
                    container.ResolveAll<IBlyncLightBehaviour>().OrderByDescending(s => s.Priority).ToList()));

            //Client
            container.Register(typeof(BlyncLightForSkypeClient),
                new BlyncLightForSkypeClient());
        }
예제 #10
0
        protected override void ConfigureApplicationContainer(TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);

            container.Register<ISirenDocumentWriter<Order>, OrderWriter>();
            container.Register<ISirenDocumentWriter<OrderItemViewModel>, OrderItemViewModelWriter>();

            container.RegisterMultiple<ILinkGenerator>(new[] { typeof(OrderLinkGenerator) });
        }
예제 #11
0
 private static void RegisterStrategies(TinyIoCContainer container)
 {
     container.RegisterMultiple(typeof(IBetCalculatorStrategy), new List <Type>
     {
         typeof(NormalBetCalculatorStrategy),
         typeof(FreeBetSnrCalculatorStrategy),
         typeof(FreeBetSrCalculatorStrategy)
     });
 }
예제 #12
0
        private bool RegisterMultiple(TinyIoCContainer container, ILogger logger)
        {
            logger.WriteLine("RegisterMultiple");
            container.RegisterMultiple <ITestInterface>(new Type[] { typeof(TestClassWithInterface), typeof(TestClassWithInterface2) });

            var result = container.ResolveAll <ITestInterface>();

            return(result.Count() == 2);
        }
예제 #13
0
        private static void RegisterMenuCommands(TinyIoCContainer container)
        {
            var items = TypeFinder.FindTypesOf(typeof(IMenuCommand),
                                               new[] {
                typeof(IMenuCommand).Assembly,
                typeof(ContainerBuilder).Assembly
            });

            container.RegisterMultiple(typeof(IMenuCommand), items);
        }
예제 #14
0
        private void RegisterScenarios(TinyIoCContainer container)
        {
            var scenarios = AssemblyTypeResolver
                            .GetAllTypesFromAppDomain()
                            .Where(type => type.IsScenario() && !type.IsAbstract)
                            .ToList();

            container.RegisterMultiple <IScenario>(scenarios);
            this.Log().DebugFormat("Registered {RegisteredScenarioCount} Scenarios", scenarios.Count);
        }
예제 #15
0
        private void RegisterScenarios(TinyIoCContainer container)
        {
            var scenarios = AssemblyTypeResolver
                .GetAllTypesFromAppDomain()
                .Where(type => type.IsScenario() && !type.IsAbstract)
                .ToList();

            container.RegisterMultiple<IScenario>(scenarios);
            this.Log().DebugFormat("Registered {RegisteredScenarioCount} Scenarios", scenarios.Count);
        }
예제 #16
0
 protected override void ConfigureApplicationContainer(TinyIoCContainer container)
 {
     base.ConfigureApplicationContainer(container);
     container.Register <IEquifaxRequestParser, EquifaxRequestParser>();
     container.RegisterMultiple <IHandleDefaultMessages>(new[]
     {
         typeof(DefaultEquifaxMessageHandler),
         typeof(EquifaxPasswordResetMessageHandler)
     });
 }
예제 #17
0
        public static void ConfigureContainer(TinyIoCContainer container)
        {
            container.Register(typeof(ISkypeClient), typeof(SkypeClient)).AsSingleton();
            container.Register(typeof(ILogHandler), typeof(Logger.Log4NetLogger)).AsSingleton();

            container.RegisterMultiple<IClientLifecycleCallbackHandler>(new List<Type>()
            {
                typeof (TextToSpeechBehaviour)
            });

        }
예제 #18
0
 void RegisterBundlePipelineServices(TinyIoCContainer container)
 {
     container.Register(
         typeof(IBundlePipeline <T>),
         (c, p) => CreateBundlePipeline(c)
         );
     container.RegisterMultiple(
         typeof(IBundlePipelineModifier <T>),
         getImplementationTypes(typeof(IBundlePipelineModifier <T>))
         ).AsMultiInstance();
 }
예제 #19
0
        private ServiceLocatorProvider Configure(TinyIoCContainer container)
        {
            container.AutoRegister(new[] { GetType().Assembly });
            container.Register(DefaultJwt4NetConfig.Instance);
            container.Register(DefaultJwt4NetConfig.Instance.ReaderSettings);
            container.Register(DefaultJwt4NetConfig.Instance.Issuer);
            container.Register(DefaultJwt4NetConfig.Instance.Issuer.Key);

            container.RegisterMultiple <ITokenValidationRule>(new[] { typeof(IssuerMustBeTrustedRule), typeof(SignatureMustBeValidRule), typeof(ExpiryDateMustBeInThePastRule) });
            _configured = true;
            return(() => this);
        }
예제 #20
0
        protected override void ConfigureApplicationContainer(TinyIoCContainer container)
        {
            base.ConfigureApplicationContainer(container);
            container.Register <JsonSerializer, CustomJsonSerializer>();

            container.Register <ISirenDocumentWriter <SiteDetail>, HomeWriter>();
            container.Register <ISirenDocumentWriter <Order>, OrderWriter>();
            container.Register <ISirenDocumentWriter <OrderItemViewModel>, OrderItemViewModelWriter>();


            container.RegisterMultiple <ILinkGenerator>(new[] { typeof(HomeLinkGenerator), typeof(OrderItemLinkGenerator), typeof(OrderLinkGenerator) });
        }
예제 #21
0
 void RegisterFileSearchServices(TinyIoCContainer container)
 {
     container.Register(
         typeof(IFileSearch),
         (c, p) => CreateFileSearch(c),
         HostBase.FileSearchComponentName(typeof(T))
         );
     container.RegisterMultiple(
         typeof(IFileSearchModifier <T>),
         getImplementationTypes(typeof(IFileSearchModifier <T>))
         ).AsMultiInstance();
 }
예제 #22
0
        private static void RegisterItems(TinyIoCContainer container)
        {
            var type = typeof(Item);

            var items = TypeFinder.FindTypesOf(type, type.Assembly);

            items = from item in items
                    where item.IsBrowsable()
                    orderby item.Name
                    select item;

            container.RegisterMultiple(typeof(Item), items);
        }
예제 #23
0
        public AppBootstrapper()
        {
            Router = new RoutingState();

            Kernel = new TinyIoCContainer();

            // XXX: This is gross
            Kernel.Register <UIViewController>(new RouterUINavigationController(Router), "InitialPage");

            Kernel.Register(typeof(IViewFor <iOSPlaygroundViewModel>), typeof(iOSPlaygroundViewController));
            Kernel.Register <IScreen>(this);

            var toRegister = new Dictionary <Tuple <Type, String>, List <Type> >();

            RxApp.ConfigureServiceLocator(
                (t, s) => s != null ? Kernel.Resolve(t, s) : Kernel.Resolve(t),
                (t, s) => Kernel.ResolveAll(t, true),
                (c, t, s) => {
                if (toRegister != null)
                {
                    var pair = Tuple.Create(t, s);
                    if (!toRegister.ContainsKey(pair))
                    {
                        toRegister[pair] = new List <Type>();
                    }
                    toRegister[pair].Add(c);
                    return;
                }

                if (s != null)
                {
                    Kernel.Register(t, c, s);
                }
                else
                {
                    Kernel.Register(t, c);
                }
            });

            foreach (var key in toRegister.Keys)
            {
                var val = toRegister[key].Distinct();
                Kernel.RegisterMultiple(key.Item1, val);
            }

            toRegister = null;

            var items = Kernel.ResolveAll(typeof(ICreatesObservableForProperty), true).ToArray();

            Router.Navigate.Go <iOSPlaygroundViewModel>();
        }
예제 #24
0
        public void RegisterInstances()
        {
            _kernel.Register <IApplicationContext, ApplicationContext>().AsSingleton();

            _kernel.RegisterMultiple <IRegistry>(
                new List <Type>
            {
                typeof(ManagerRegistry),
                typeof(ServerRegistry),
                typeof(ClassRegistry),
                typeof(FactoryRegistry),
                typeof(AlgorithmRegistry),
            });
        }
예제 #25
0
        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {
            container.Register <IScrapperConfiguration, ScrapperConfiguration>();
            container.Register <IHttpClient, HttpClient>();
            container.Register <IScrapper, RadioScrapper>();

            var type = typeof(IParser);

            var parserTypes = AppDomain.CurrentDomain.GetAssemblies()
                              .SelectMany(a => a.GetTypes())
                              .Where(p => type.IsAssignableFrom(p) && p.IsClass && !p.IsAbstract);

            container.RegisterMultiple <IParser>(parserTypes);
        }
예제 #26
0
        protected override void ConfigureApplicationContainer(TinyIoCContainer nancyContainer)
        {
            nancyContainer.Register(_nancyModuleCatalog);

            // Соглашения обработки запросов должны устанавливаться явно, так как автоматический поиск соглашений в Mono/Linux не работает,
            // поскольку при поиске Nancy использует метод AppDomain.CurrentDomain.GetAssemblies(), который возвращает все сборки текущего
            // домена приложения, кроме той, который его вызывала. Ниже зарегистрированы соглашения, используемые Nancy по умолчанию.

            nancyContainer.RegisterMultiple <IConvention>(new[]
            {
                typeof(DefaultViewLocationConventions),
                typeof(DefaultStaticContentsConventions),
                typeof(DefaultAcceptHeaderCoercionConventions),
                typeof(DefaultCultureConventions)
            }).AsSingleton();
        }
예제 #27
0
        public static void ConfigureContainer(TinyIoCContainer container)
        {
            container.Register(typeof(ILogHandler), typeof(Logger.Log4NetLogger)).AsSingleton();
            container.Register<InMemorySessionManager>().AsSingleton();

            var sessionManager = container.Resolve<InMemorySessionManager>();
            container.Register<ISessionHandler, InMemorySessionManager>(sessionManager);

            container.RegisterMultiple<IMessageLifecycleCallbackHandler>(new List<Type>()
            {
                typeof (SessionMessageLifecycleCallback),
                typeof (SpamManager)
            }).AsSingleton();

            container.Register(typeof(TorqueMasterServer),
                new TorqueMasterServer(container, new IPEndPoint(IPAddress.Any, 28002)));
        }
예제 #28
0
        private async Task ApplicationStartupAsync(TinyIoCContainer container, IPipelines pipelines)
        {
            var endpointInstance = await BusUtils.CreateBus("mskmanager.frontoffice", (config, route) => {
                route.RouteToEndpoint(typeof(AddDeezerUser), "mskmanager.persistence");
            });

            container.Register(endpointInstance);


            var type           = typeof(IValidator);
            var validatorTypes = AppDomain.CurrentDomain.GetAssemblies()
                                 .Where(a => a.FullName.Contains("MskManager.Frontoffice"))
                                 .SelectMany(a => a.GetTypes())
                                 .Where(p => type.IsAssignableFrom(p) && p.IsClass && !p.IsAbstract);

            container.RegisterMultiple(type, validatorTypes);
        }
예제 #29
0
        public AppBootstrapper()
        {
            Router = new RoutingState();

            Kernel = new TinyIoCContainer();

            // XXX: This is gross
            Kernel.Register<UIViewController>(new RouterUINavigationController(Router), "InitialPage");

            Kernel.Register(typeof(IViewFor<iOSPlaygroundViewModel>), typeof(iOSPlaygroundViewController));
            Kernel.Register<IScreen>(this);

            var toRegister = new Dictionary<Tuple<Type, String>, List<Type>>();

            RxApp.ConfigureServiceLocator(
                (t, s) => s != null ? Kernel.Resolve(t, s) : Kernel.Resolve(t),
                (t, s) => Kernel.ResolveAll(t, true),
                (c, t, s) => { 
                    if (toRegister != null) {
                        var pair = Tuple.Create(t,s);
                        if (!toRegister.ContainsKey(pair)) {
                            toRegister[pair] = new List<Type>();
                        }
                        toRegister[pair].Add(c);
                        return;
                    }

                    if (s != null) { 
                        Kernel.Register(t, c, s); 
                    } else { 
                        Kernel.Register(t, c); 
                    } 
                });

            foreach(var key in toRegister.Keys) {
                var val = toRegister[key].Distinct();
                Kernel.RegisterMultiple(key.Item1, val);
            }

            toRegister = null;

            var items = Kernel.ResolveAll(typeof(ICreatesObservableForProperty), true).ToArray();

            Router.Navigate.Go<iOSPlaygroundViewModel>();
        }
예제 #30
0
        protected ViewModelLocator(bool isAgent)
        {
            _container = new TinyIoCContainer();
            var assms   = new [] { typeof(ViewModelLocator).GetTypeInfo().Assembly };
            var typeinf = typeof(IToolViewModel).GetTypeInfo();

            if (isAgent)
            {
                var src = typeof(ClientMainService);
                _container.AutoRegister(assms, t => t != src && !typeinf.IsAssignableFrom(t.GetTypeInfo())); // skip the client service in agent mode
                Mode = AppMode.Agent;
            }
            else
            {
                var arc = typeof(AgentMainService);
                _container.AutoRegister(assms, t => t != arc && !typeinf.IsAssignableFrom(t.GetTypeInfo())); // skip the agent service in client mode
                Mode = AppMode.Client;
            }

            _container.Register <IViewModelLocator>(this);

            var tools = new []
            {
                //typeof(SampleToolViewModel),
                typeof(TypesOfInsuranceViewModel),
                typeof(DividendInterestRatesViewModel),
                typeof(BasicInformationToolViewModel),
                typeof(LifetimeEconomicValueViewModel),
                //typeof(AnotherSampleToolViewModel),
            };


            _container.RegisterMultiple <IToolViewModel>(tools).AsMultiInstance();


            InitializeTypes();

            _container.Resolve <INavigationService>().Initialize();
        }
예제 #31
0
        protected virtual void RegisterMultiple(Type type, TinyIoCContainer container, IEnumerable<Func<Assembly, bool>> ignoredAssemblies)
        {
            foreach (var group in AppDomain.CurrentDomain.GetAssemblies()
                .Where(a => !ignoredAssemblies.Any(ia => ia(a)))
                .SelectMany(t => t.GetTypes())
                .Where(t => t.GetInterfaces().Any(i => i.IsGenericType && i.GetGenericTypeDefinition() == type) && t.IsClass)
                .ToList().GroupBy(implType => implType.GetInterfaces().Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == type), implType => implType))
            {
                foreach (var item in group.Key)
                {

                    container.RegisterMultiple(item, group);
                }

            }
        }
        protected virtual void BindServices(CompositionBatch batch)
        {
            try
            {
                _tinyIoCContainer = new TinyIoCContainer();
                var eventAggregator = new EventAggregator();

                // Defaults
                batch.AddExportedValue<IWindowManager>(new WindowManager());
                batch.AddExportedValue<IEventAggregator>(eventAggregator);

                // framework and infrastructure
                _tinyIoCContainer.Register<IEventAggregator>(eventAggregator);
                // _tinyIoCContainer.Register<IServiceLocator>(new TinyServiceLocator(_container));
                _tinyIoCContainer.RegisterMultiple<IMessageEventSubscriber>(new[] {typeof (EventMessageListener)})
                    .AsSingleton();

                // register other implementations
                DependencyFactory.Configure(_tinyIoCContainer);

                // Export IoC registrations
                batch.AddExportedValue(_tinyIoCContainer.Resolve<IRestartableMessageListener>());

                batch.AddExportedValue(Container);
            }
            catch (Exception e)
            {
                Log.Error(e, "Error on Bootstrapper BindServices: {CompositionBatch}", batch);
            }
        }
 public void RegisterMultiple <RegisterType>(IEnumerable <Type> implementationTypes)
 {
     _container.RegisterMultiple <RegisterType>(implementationTypes);
 }
예제 #34
0
        protected override void Configure(TinyIoCContainer container)
        {
            // Register Mappings:
            container.RegisterMultiple<IMap>(new [] { typeof(SampleEntityMapping) });

            // Register DAO:
            container.Register<SampleEntityDao>();
        }
예제 #35
0
        /// <summary>
        ///  注册
        /// </summary>
        public static void RegisterTypes <TServiceType>() where TServiceType : class
        {
            var list = GetTypes().Where(t => typeof(TServiceType).IsAssignableFrom(t) && t.IsClass && !t.IsAbstract && !t.IsInterface);

            _container.RegisterMultiple(typeof(TServiceType), list);
        }
예제 #36
0
파일: HostBase.cs 프로젝트: WS-QA/cassette
 void RegisterStartUpTasks()
 {
     container.RegisterMultiple(typeof(IStartUpTask), GetStartUpTaskTypes());
 }
예제 #37
0
 public void RegisterAllAsSingleton(Type registrationType, IEnumerable <Type> implementationList)
 {
     _container.RegisterMultiple(registrationType, implementationList).AsSingleton();
 }
 /// <summary>
 /// Register multiple implementations of a type.
 /// </summary>
 /// <typeparam name="TRegisterType">Type that each implementation implements</typeparam>
 /// <param name="container">TinyIoC container to register with.</param>
 /// <param name="assemblies">
 /// Assembly collection containing defined types to be retrieved.
 /// Defaults to all current domain assemblies.
 /// </param>
 /// <returns>MultiRegisterOptions for the fluent API.</returns>
 public static TinyIoCContainer.MultiRegisterOptions RegisterMultiple <TRegisterType>(this TinyIoCContainer container, params Assembly[] assemblies)
     where TRegisterType : class
 {
     return(container.RegisterMultiple <TRegisterType>((assemblies ?? AppDomain.CurrentDomain.GetAssemblies()).GetConcreteTypes <TRegisterType>()));
 }