예제 #1
0
 /// <summary>
 /// Register All interface from Xconso Namespace.
 /// </summary>
 /// <param name="pType"></param>
 /// <param name="pRegistry"></param>
 public void Process(Type pType, IUnityRegistry pRegistry)
 {
     if (pType.BaseType == typeof(ViewModelBase))
     {
         pRegistry.Register(pType, pType).AsSingleton();
     }
 }
 public void Process(Type pType, IUnityRegistry pRegistry)
 {
     if (pType.BaseType != null && pType.BaseType.IsAssignableFrom(typeof(ExoCommand)))
     {
         pRegistry.Register(pType, pType).AsSingleton();
     }
 }
예제 #3
0
 /// <summary>
 /// Register All interface from Xconso Namespace.
 /// </summary>
 /// <param name="pType"></param>
 /// <param name="pRegistry"></param>
 public void Process(Type pType, IUnityRegistry pRegistry)
 {
     foreach (var lInterface in pType.GetInterfaces().Where(pX => pX.Namespace != null && pX.Namespace.StartsWith("WS_Hotline")))
     {
         pRegistry.Register(lInterface, pType).AsSingleton();
     }
 }
        void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
        {
            Type @interface = FindInterface(type);

            if(@interface != null)
                registry.Register(@interface, type);
        }
 void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
 {
     if (type == typeof(FooService))
     {
         registry.Register <IFooService, FooService>().WithName("Custom");
     }
 }
        public void Process(Type pType, IUnityRegistry pRegistry)
        {
            foreach (var lTypeInterface in this._typesInterfaces)
            {
                IEnumerable <Type> lTypesFrom = null;
                if (pType.CanBeCastTo(lTypeInterface))
                {
                    lTypesFrom = new[] { lTypeInterface };
                }
                else if (pType.ImplementsInterfaceTemplate(lTypeInterface))
                {
                    Type lInterface = lTypeInterface;
                    lTypesFrom = pType.GetInterfaces().Where(pI => pI.IsGenericType && pI.GetGenericTypeDefinition() == lInterface);
                }

                if (lTypesFrom == null)
                {
                    continue;
                }

                foreach (var lTypeFrom in lTypesFrom.Where(t => !t.CanBeCreated()))
                {
                    var lExpression = pRegistry.Register(lTypeFrom, pType).WithName(this._getName(pType));

                    if (this._lifetimePolicyAction != null)
                    {
                        this._lifetimePolicyAction(lExpression);
                    }
                }
            }
        }
        void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
        {
            Type @interface = FindInterface(type);

            if (@interface != null)
            {
                registry.Register(@interface, type);
            }
        }
        void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
        {
            if (!type.IsConcrete() || !type.CanBeCreated())
                return;

            Type interfaceType = GetInterfaceType(type);

            if (interfaceType != null)
                registry.Register(interfaceType, type);
        }
예제 #9
0
        void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
        {
            IEnumerable <PropertyInfo> properties =
                type.GetProperties().Where(p => p.CanWrite && p.PropertyType == interfaceType);

            foreach (PropertyInfo property in properties)
            {
                registry.Register(null, type).WithInjectionMembers(new InjectionProperty(property.Name));
            }
        }
        void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
        {
            if (type.CanBeCastTo(interfaceType) && type.CanBeCreated())
            {
                var expression = registry.Register(interfaceType, type).WithName(getName(type));

                if (lifetimePolicyAction != null)
                {
                    lifetimePolicyAction(expression);
                }
            }
        }
예제 #11
0
        void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
        {
            if (!type.IsConcrete() || !type.CanBeCreated())
            {
                return;
            }

            Type interfaceType = GetInterfaceType(type);

            if (interfaceType != null)
            {
                registry.Register(interfaceType, type);
            }
        }
        void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
        {
            Type typeFrom = null;

            if (type.CanBeCastTo(interfaceType))
            {
                typeFrom = interfaceType;
            }
            else if (type.ImplementsInterfaceTemplate(interfaceType))
            {
                typeFrom = type.GetInterfaces().FirstOrDefault(i => i.GetGenericTypeDefinition() == interfaceType);
            }

            if (typeFrom != null && type.CanBeCreated())
            {
                var expression = registry.Register(typeFrom, type).WithName(getName(type));

                if (lifetimePolicyAction != null)
                {
                    lifetimePolicyAction(expression);
                }
            }
        }
 void IAssemblyScannerConvention.Process(Type type, IUnityRegistry registry)
 {
     if (type == typeof(FooService))
         registry.Register<IFooService, FooService>().WithName("Custom");
 }