예제 #1
0
        private static void ProcessType(IContainerConfiguration container, TypeInfo concreteType, Type serviceType)
        {
            var typeDefinition = serviceType.GetGenericTypeDefinition();

            if (HandlerTypeDefinitions.Any(h => h == typeDefinition))
            {
                var serviceScope =
                    concreteType.GetServiceScope() ??
                    ServiceScope.Default;

                container.
                    Register(serviceType).
                    InScope(serviceScope).
                    UsingConcreteType(concreteType.AsType());
            }
        }
예제 #2
0
        private static void ProcessServiceType(IContainerConfiguration container, TypeInfo concreteType, Type serviceType)
        {
            if (serviceType.IsConstructedGenericType)
            {
                var typeDefinition = serviceType.GetGenericTypeDefinition();
                if (typeDefinition == SettingsHandlerTypeDefinition)
                {
                    var serviceScope =
                        concreteType.GetServiceScope() ??
                        ServiceScope.Default;

                    container.
                        Register(serviceType).
                        InScope(serviceScope).
                        UsingConcreteType(concreteType.AsType());
                }
            }
        }