Esempio n. 1
0
        public MethodInvocationExpression CreateConstructorInvocationWithReferencedEntities(IType type, Method containingMethod)
        {
            GeneratorTypeReplacer mapper;

            type = GeneratorTypeReplacer.MapTypeInMethodContext(type, containingMethod, out mapper);
            MethodInvocationExpression mie = CodeBuilder.CreateConstructorInvocation(type.GetConstructors().First());

            foreach (var entity in _referencedEntities.Keys)
            {
                mie.Arguments.Add(CreateForeignReference(entity));
            }
            if (mapper != null)
            {
                mie.Accept(new GenericTypeMapper(mapper));
            }
            return(mie);
        }