CreateFunctionalConstructor() private method

private CreateFunctionalConstructor ( List annotations ) : CodeConstructor
annotations List
return System.CodeDom.CodeConstructor
Beispiel #1
0
        private CodeTypeDeclaration ProcessType(ClrContentTypeInfo typeInfo, string parentIdentifier, bool globalType)
        {
            SetFullTypeName(typeInfo, parentIdentifier);

            if (globalType)
            {
                currentNamespace = typeInfo.clrtypeNs;
            }

            //Build type using TypeBuilder
            typeBuilder = GetTypeBuilder();
            typeBuilder.CreateTypeDeclaration(typeInfo);
            ProcessProperties(typeInfo.Content, typeInfo.Annotations);
            typeBuilder.CreateFunctionalConstructor(typeInfo.Annotations);
            typeBuilder.ImplementInterfaces(settings.EnableServiceReference);
            typeBuilder.ApplyAnnotations(typeInfo);
            if (globalType)
            {
                if (typeInfo.typeOrigin == SchemaOrigin.Fragment)
                {
                    typeBuilder.AddTypeToTypeManager(typeDictionaryAddStatements, Constants.TypeDictionaryField);
                }
                else
                {
                    typeBuilder.AddTypeToTypeManager(elementDictionaryAddStatements, Constants.ElementDictionaryField);
                }
            }

            CodeTypeDeclaration builtType = typeBuilder.TypeDeclaration;

            ProcessNestedTypes(typeInfo.NestedTypes, builtType, typeInfo.clrFullTypeName);
            return(builtType);
        }
Beispiel #2
0
        private CodeTypeDeclaration ProcessType(ClrContentTypeInfo typeInfo, string parentIdentifier, bool globalType)
        {
            SetFullTypeName(typeInfo, parentIdentifier);

            if(globalType) {
                currentNamespace = typeInfo.clrtypeNs;
            }
            //Build type using TypeBuilder
            typeBuilder = GetTypeBuilder();
            typeBuilder.CreateTypeDeclaration(typeInfo);
            ProcessProperties(typeInfo.Content, typeInfo.Annotations);
            typeBuilder.CreateFunctionalConstructor(typeInfo.Annotations);
            typeBuilder.ImplementInterfaces(settings.EnableServiceReference);
            typeBuilder.ApplyAnnotations(typeInfo);
            if (globalType) {
                if (typeInfo.typeOrigin == SchemaOrigin.Fragment) {
                    typeBuilder.AddTypeToTypeManager(typeDictionaryAddStatements, Constants.TypeDictionaryField);
                }
                else {
                    typeBuilder.AddTypeToTypeManager(elementDictionaryAddStatements, Constants.ElementDictionaryField);
                }
            }
            CodeTypeDeclaration builtType = typeBuilder.TypeDeclaration;
            ProcessNestedTypes(typeInfo.NestedTypes, builtType, typeInfo.clrFullTypeName);
            return builtType;
        }