public virtual string BeginWriteLoop(TemplateContext ctx, IMappingsConnectable connectable)
        {
            // ctx.PushStatements(ctx._if("{0} != null", ContextNode.SystemPropertyName).TrueStatements);

            ctx._("var {0}Items = {1}", connectable.Name, connectable.EnumeratorExpression);

            var iteration = new CodeIterationStatement(
                new CodeSnippetStatement(string.Format("var {0}Index = 0", connectable.Name)),
                new CodeSnippetExpression(string.Format("{0}Index < {0}Items.Count", connectable.Name)),
                new CodeSnippetStatement(string.Format("{0}Index++", connectable.Name))
                );

            ctx.CurrentStatements.Add(iteration);
            ctx.PushStatements(iteration.Statements);
            return(string.Format("{0}Items[{0}Index]", connectable.Name));
        }
Example #2
0
 private void CreateFilterProperty(IFilterInput input, IMappingsConnectable inputFilter)
 {
     Ctx.CurrentDeclaration._public_(inputFilter.ContextTypeName, input.HandlerPropertyName);
 }
        private void CreateFilterProperty(IFilterInput input, IMappingsConnectable inputFilter)
        {
            Ctx.CurrentDeclaration._public_(inputFilter.ContextTypeName, input.HandlerPropertyName);

        }
        public virtual string BeginWriteLoop(TemplateContext ctx, IMappingsConnectable connectable)
        {
            // ctx.PushStatements(ctx._if("{0} != null", ContextNode.SystemPropertyName).TrueStatements);

            ctx._("var {0}Items = {1}", connectable.Name, connectable.EnumeratorExpression);

            var iteration = new CodeIterationStatement(
                new CodeSnippetStatement(string.Format("var {0}Index = 0", connectable.Name)),
                new CodeSnippetExpression(string.Format("{0}Index < {0}Items.Count", connectable.Name)),
                new CodeSnippetStatement(string.Format("{0}Index++", connectable.Name))
                );

            ctx.CurrentStatements.Add(iteration);
            ctx.PushStatements(iteration.Statements);
            return string.Format("{0}Items[{0}Index]", connectable.Name);
        }