예제 #1
0
 void WriteAssignments(Message message, CodeWriter writer)
 {
     foreach (var member in message.Members)
     {
         writer.WriteLine("{0} = {1};", GeneratorUtil.MemberCase(member.Name), GeneratorUtil.ParameterCase(member.Name));
     }
 }
예제 #2
0
        static void Rebuild(string text, string fullPath)
        {
            var dsl       = text;
            var generator = new TemplatedGenerator()
            {
                Namespace = "Sample",
                GenerateInterfaceForEntityWithModifiers = "?",
                TemplateForInterfaceName   = "public interface I{0}Aggregate",
                TemplateForInterfaceMember = "void When({0} c);",
                ClassNameTemplate          = @"
    

[DataContract(Namespace = ""Sample"")]
public partial class {0}",
                MemberTemplate             = "[DataMember(Order = {0})] public {1} {2} {{ get; private set; }}",
                PrivateCtorTemplate        = @"
{0} () {{}}"
            };

            var prefix = @"
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

";

            File.WriteAllText(Path.ChangeExtension(fullPath, "cs"), prefix + GeneratorUtil.Build(dsl, generator));
        }
예제 #3
0
        void WriteMembers(Message message, CodeWriter writer)
        {
            var idx = 1;

            foreach (var member in message.Members)
            {
                writer.WriteLine(MemberTemplate, idx, member.Type, GeneratorUtil.MemberCase(member.Name));


                idx += 1;
            }
        }
예제 #4
0
        void WriteParameters(Message message, CodeWriter writer)
        {
            var first = true;

            foreach (var member in message.Members)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    writer.Write(", ");
                }
                writer.Write("{0} {1}", member.Type, GeneratorUtil.ParameterCase(member.Name));
            }
        }