Exemplo n.º 1
0
        /// <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);
                            }
                        }
                    }
                }
            }
        }