public static TypeFactory GetFactoryFor(string typeName)
        {
            int  typeId;
            Type clrType;

            try
            {
                typeId  = TypeManager.GetTypeByName(typeName).ID;
                clrType = TypeManager.GetImplementingClass(typeId);
            }
            catch (RuntimeException e)
            {
                if (NewInstanceHandler != null)
                {
                    clrType = NewInstanceHandler;
                }
                else
                {
                    throw new RuntimeException("Конструктор не найден (" + typeName + ")", e);
                }
            }

            if (!_factories.TryGetValue(clrType, out var factory))
            {
                factory             = new TypeFactory(clrType);
                _factories[clrType] = factory;
            }

            return(factory);
        }
Beispiel #2
0
        public static Type GetFactoryFor(string typeName)
        {
            int  typeId;
            Type clrType;

            try
            {
                typeId  = TypeManager.GetTypeByName(typeName).ID;
                clrType = TypeManager.GetImplementingClass(typeId);
            }
            catch (KeyNotFoundException)
            {
                if (NewInstanceHandler != null)
                {
                    clrType = NewInstanceHandler;
                }
                else
                {
                    throw new RuntimeException("Конструктор не найден (" + typeName + ")");
                }
            }

            return(clrType);
        }
Beispiel #3
0
 public TypeTypeValue(string name)
 {
     _instance = TypeManager.GetTypeByName(name);
 }