Ejemplo n.º 1
0
        private bool CanCreateEntity(FactoryConfiguration factoryConfig, Type entityType)
        {
            Type factoryType = factoryConfig.FactoryType;

            if (factoryType == null)
            {
                return(false);
            }

            Type[] interfaces = factoryType.GetInterfaces();

            foreach (Type t in interfaces)
            {
                if (t.Name.StartsWith("IFactory") && TypeHelper.IsGenericType(t))
                {
                    //verfico si es asignable
                    Type entType = TypeHelper.GetFirstGenericArgumentType(t);
                    if (TypeHelper.CanAssign(entType, entityType))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        public object GetConfiguration(Type typeOf)
        {
            if (this.Configuration == null)
            {
                return(null);
            }
            if (TypeHelper.CanAssign(this.Configuration, typeOf))
            {
                return(this.Configuration);
            }

            return(null);
        }