public IConstructor Map(ConstructorInfo constructor) { object key = GetCacheKey(constructor); IConstructor entity = (IConstructor)_entityCache[key]; if (null == entity) { entity = new ExternalConstructor(this, constructor); _entityCache[key] = entity; } return(entity); }
public virtual IConstructor[] GetConstructors() { if (null == _constructors) { BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; ConstructorInfo[] ctors = _type.GetConstructors(flags); _constructors = new IConstructor[ctors.Length]; for (int i = 0; i < _constructors.Length; ++i) { _constructors[i] = new ExternalConstructor(_typeSystemServices, ctors[i]); } } return(_constructors); }
public virtual IConstructor[] GetConstructors() { if (null == _constructors) { BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance; ConstructorInfo[] ctors = _type.GetConstructors(flags); _constructors = new IConstructor[ctors.Length]; for (int i=0; i<_constructors.Length; ++i) { _constructors[i] = new ExternalConstructor(_typeSystemServices, ctors[i]); } } return _constructors; }
private void ReplaceWithComponentReference(Node node, string name) { Expression argument; ConstructorInfo constructorInfo; name = name.Substring(1); var entity = NameResolutionService.ResolveQualifiedName(name); if (node.ParentNode.NodeType == NodeType.GenericReferenceExpression) { var genericRef = (GenericReferenceExpression)(node = node.ParentNode); entity = NameResolutionService.ResolveGenericReferenceExpression(genericRef, entity); name = genericRef.ToCodeString(); } if (entity == null || entity.EntityType != EntityType.Type) { constructorInfo = _componentReferenceConstructor; argument = CodeBuilder.CreateStringLiteral(name); } else { constructorInfo = _componentReferenceTypeConstructor; argument = CodeBuilder.CreateReference(entity); } var constructor = new ExternalConstructor(My<IReflectionTypeSystemProvider>.Instance, constructorInfo); var invocation = CodeBuilder.CreateConstructorInvocation(constructor, argument); node.ParentNode.Replace(node, invocation); }
private void ReplaceWithComponentReference(Node node, string name) { Expression argument; ConstructorInfo constructorInfo; name = name.Substring(1); IEntity entity = NameResolutionService.ResolveQualifiedName(name); if (entity == null || entity.EntityType != EntityType.Type) { constructorInfo = _componentReferenceConstructor; argument = CodeBuilder.CreateStringLiteral(name); } else { constructorInfo = _componentReferenceTypeConstructor; argument = CodeBuilder.CreateReference(entity); } ExternalConstructor constructor = new ExternalConstructor(TypeSystemServices, constructorInfo); MethodInvocationExpression invocation = CodeBuilder.CreateConstructorInvocation(constructor, argument); node.ParentNode.Replace(node, invocation); }
public IConstructor Map(ConstructorInfo constructor) { object key = GetCacheKey(constructor); IConstructor entity = (IConstructor)_entityCache[key]; if (null == entity) { entity = new ExternalConstructor(this, constructor); _entityCache[key] = entity; } return entity; }