Esempio n. 1
0
 public void Execute(string query)
 {
     using var ownedInput = inputFactory.Create();
     using var tempOutput = new StringWriter();
     textTransformer.Transform(ownedInput.Value, tempOutput, query);
     using var ownedOutput = outputFactory.Create();
     ownedOutput.Value.Write(tempOutput);
 }
        public override string Act(ITextTransformer transformer, string template)
        {
            var arguments = new TemplateArgumentCollection
            {
                new TemplateArgument("Argument1", "This is argument1 Value!"),
                new TemplateArgument {
                    Name = "Argument2", Value = "This is argument2 Value!"
                },
                new TemplateArgument("Argument3", "This is argument3 Value!")
            };

            return(transformer.Transform(template, arguments));
        }
        public override string Act(ITextTransformer transformer, string template)
        {
            //Prepare the argument that will be passes to the template
            var classDefinition = new ClassDefinition
            {
                Name      = "TestClass",
                Namespace = "TC.CustomTemplating.Example.Generated"
            };

            classDefinition.Properties.Add(new Property("Name", typeof(string)));
            classDefinition.Properties.Add(new Property("Lenght", typeof(int)));
            classDefinition.Properties.Add(new Property("L", typeof(int)));

            return(transformer.Transform(template, "Class", classDefinition));
        }
        public override string Act(ITextTransformer transformer, string template)
        {
            var dictionary = new Dictionary <int, List <string> >
            {
                { 0, new List <string> {
                      "one", "two", "three"
                  } },
                { 4, new List <string> {
                      "four", "five", "six"
                  } },
                { 7, new List <string> {
                      "seven", "eight", "nine"
                  } }
            };

            return(transformer.Transform(template, "Argument", dictionary));
        }
 public override string Act(ITextTransformer transformer, string template)
 {
     return(transformer.Transform(template));
 }
 /// <summary>
 /// Transforms the specified template without using an argument.
 /// </summary>
 /// <param name="template">The template.</param>
 /// <exception cref="TextTransformationException">Text transformation has failed.</exception>
 /// <exception cref="ArgumentNullException">template is null or empty.</exception>
 /// <returns>The output of the text transformation.</returns>
 public static string Transform(string template)
 {
     return(_transformer.Transform(template));
 }
 public override string Act(ITextTransformer transformer, string template)
 {
     return(transformer.Transform(template, "Argument", "This is the argument value"));
 }