/// <summary> /// Property process /// </summary> /// <param name="type">Represents a type declaration for a class, structure, interface, or enumeration</param> /// <param name="ns">The ns.</param> /// <param name="member">Type members include fields, methods, properties, constructors and nested types</param> /// <param name="xmlElement">Represent the root element in schema</param> /// <param name="schema">XML Schema</param> protected override void ProcessProperty(CodeTypeDeclaration type, CodeNamespace ns, CodeTypeMember member, XmlSchemaElement xmlElement, XmlSchema schema) { // Get now if property is array before base.ProcessProperty call. var prop = (CodeMemberProperty)member; base.ProcessProperty(type, ns, member, xmlElement, schema); // Generate automatic properties. if (GeneratorContext.GeneratorParams.Language == GenerationLanguage.CSharp) { if (GeneratorContext.GeneratorParams.PropertyParams.AutomaticProperties) { // Exclude collection type if (CollectionTypesFields.IndexOf(prop.Name) == -1) { // Get private fieldName var propReturnStatment = prop.GetStatements[0] as CodeMethodReturnStatement; if (propReturnStatment != null) { var field = propReturnStatment.Expression as CodeFieldReferenceExpression; if (field != null) { // Check if private field don't need initialisation in ctor (defaut value). if (this.fieldWithAssignementInCtorListField.FindIndex(p => p == field.FieldName) == -1) { this.autoPropertyListField.Add(member as CodeMemberProperty); } } } } } } }
/// <summary> /// Property process /// </summary> /// <param name="type">Represents a type declaration for a class, structure, interface, or enumeration</param> /// <param name="ns">The ns.</param> /// <param name="prop">Type members include fields, methods, properties, constructors and nested types</param> /// <param name="xmlElement">Represent the root element in schema</param> /// <param name="schema">XML Schema</param> protected override void ProcessProperty(CodeTypeDeclaration type, CodeNamespace ns, CodeMemberProperty prop, XmlSchemaElement xmlElement, XmlSchema schema) { // Get now if property is array before base.ProcessProperty call. base.ProcessProperty(type, ns, prop, xmlElement, schema); //int i = 0; // Generate automatic properties. if (GeneratorContext.GeneratorParams.Language == GenerationLanguage.CSharp) { if (GeneratorContext.GeneratorParams.PropertyParams.AutomaticProperties) { //bool excludeType = false; // Exclude collection type if (CollectionTypesFields.IndexOf(prop.Name) == -1) { // Get private fieldName var fieldName = prop.GetFieldNameFromProperty(); if (fieldName != null) { // Check if private field don't need initialisation in ctor (defaut value). if (!ctor.CheckFieldInCtor(fieldName)) { this.autoPropertyListField.Add(prop); } } } } } }