private void addMembersForType(ComplexType node, List<MemberDescription> members)
        {
            foreach (var complexTypeProperty in node.Properties)
            {
                members.Add(MemberDescription.Field(
                    complexTypeProperty.Name + "Field",
                    XsdTypeEvaluator.GetAlias(complexTypeProperty.Type, templateOperations.Debug)));

                members.Add(MemberDescription.Property(
                    complexTypeProperty.Name,
                    XsdTypeEvaluator.GetAlias(complexTypeProperty.Type, templateOperations.Debug),
                    null,
                        new[]
                            {
                                new AttributeDescription()
                                    {
                                        Name =
                                            "System.Runtime.Serialization.DataMemberAttribute"
                                    },
                            }));

            }
        }
        public void OutputComplexType(string namespaceUri, ComplexType node)
        {
            var name = node.Name;

            templateOperations.StartFile(name + ".generated.cs");

            var members = new List<MemberDescription>();

            members.Add(MemberDescription.Field("extensionDataField", "System.Runtime.Serialization.ExtensionDataObject"));
            members.Add(MemberDescription.Property("ExtensionData", "System.Runtime.Serialization.ExtensionDataObject", "extensionData", null));

            addMembersForType(node, members);

            var namespaceName = NamespaceUtility.NamespaceName(namespaceUri);

            var baseTypes = new[] { "object", "System.Runtime.Serialization.IExtensibleDataObject" };
            var typeClass = templateOperations.ClassGenerator
                (name, members, baseTypes,dataContractAttributes,false);

            templateOperations.WriteLine(templateOperations.NamespaceGenerator(namespaceName, typeClass.TransformText()).TransformText());

            templateOperations.EndFile();
        }
            public ComplexTypeBuilder AddComplexType(string name, ComplexType value, string namespaceUri)
            {
                var ns = NamespaceUtility.NamespaceName(namespaceUri);

                complexType.Properties.Add(new ComplexType.ComplexTypeProperty() {Name = name, ComplexType = ns + "." + value.Name });
                return this;
            }
 private ComplexTypeBuilder(string name)
 {
     complexType = new ComplexType()
                       {
                           Name = name,
                       };
 }