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); }
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); }