protected override CodeTypeDeclaration BeginClass()
        {
            methodNames.Clear();
            CodeAttributeDeclarationCollection metadata = new CodeAttributeDeclarationCollection();

            if (Style == ServiceDescriptionImportStyle.Client)
            {
                WebCodeGenerator.AddCustomAttribute(metadata, typeof(DebuggerStepThroughAttribute), new CodeExpression[0]);
                WebCodeGenerator.AddCustomAttribute(metadata, typeof(DesignerCategoryAttribute), new CodeExpression[] { new CodePrimitiveExpression("code") });
            }

            Type[] requiredTypes = new Type[] { typeof(SoapDocumentMethodAttribute), typeof(XmlAttributeAttribute), typeof(WebService), typeof(Object), typeof(DebuggerStepThroughAttribute), typeof(DesignerCategoryAttribute) };
            WebCodeGenerator.AddImports(this.CodeNamespace, WebCodeGenerator.GetNamespacesForTypes(requiredTypes));
            CodeTypeDeclaration codeClass = WebCodeGenerator.CreateClass(this.ClassName, BaseClass.FullName,
                                                                         new string[0], metadata, CodeFlags.IsPublic | (Style == ServiceDescriptionImportStyle.Client ? 0 : CodeFlags.IsAbstract));

            codeClass.Comments.Add(new CodeCommentStatement("<remarks/>", true));

            CodeConstructor ctor = WebCodeGenerator.AddConstructor(codeClass, new string[0], new string[0], null, CodeFlags.IsPublic);

            ctor.Comments.Add(new CodeCommentStatement("<remarks/>", true));

            HttpAddressBinding httpAddressBinding = Port == null ? null : (HttpAddressBinding)Port.Extensions.Find(typeof(HttpAddressBinding));
            string             url = (httpAddressBinding != null) ? httpAddressBinding.Location : null;
            ServiceDescription serviceDescription = Binding.ServiceDescription;

            ProtocolImporterUtil.GenerateConstructorStatements(ctor, url, serviceDescription.AppSettingUrlKey, serviceDescription.AppSettingBaseUrl);

            codeClasses.Add(codeClass);
            return(codeClass);
        }
        protected override CodeTypeDeclaration BeginClass()
        {
            base.MethodNames.Clear();
            base.ExtraCodeClasses.Clear();
            CodeAttributeDeclarationCollection metadata = new CodeAttributeDeclarationCollection();

            if (base.Style == ServiceDescriptionImportStyle.Client)
            {
                WebCodeGenerator.AddCustomAttribute(metadata, typeof(DebuggerStepThroughAttribute), new CodeExpression[0]);
                WebCodeGenerator.AddCustomAttribute(metadata, typeof(DesignerCategoryAttribute), new CodeExpression[] { new CodePrimitiveExpression("code") });
            }
            Type[] types = new Type[] { typeof(SoapDocumentMethodAttribute), typeof(XmlAttributeAttribute), typeof(WebService), typeof(object), typeof(DebuggerStepThroughAttribute), typeof(DesignerCategoryAttribute), typeof(TransactionOption) };
            WebCodeGenerator.AddImports(base.CodeNamespace, WebCodeGenerator.GetNamespacesForTypes(types));
            CodeFlags isAbstract = (CodeFlags)0;

            if (base.Style == ServiceDescriptionImportStyle.Server)
            {
                isAbstract = CodeFlags.IsAbstract;
            }
            else if (base.Style == ServiceDescriptionImportStyle.ServerInterface)
            {
                isAbstract = CodeFlags.IsInterface;
            }
            CodeTypeDeclaration codeClass = WebCodeGenerator.CreateClass(base.ClassName, this.BaseClass.FullName, new string[0], metadata, CodeFlags.IsPublic | isAbstract, base.ServiceImporter.CodeGenerator.Supports(GeneratorSupport.PartialTypes));

            codeClass.Comments.Add(new CodeCommentStatement(System.Web.Services.Res.GetString("CodeRemarks"), true));
            CodeConstructor ctor = WebCodeGenerator.AddConstructor(codeClass, new string[0], new string[0], null, CodeFlags.IsPublic);

            ctor.Comments.Add(new CodeCommentStatement(System.Web.Services.Res.GetString("CodeRemarks"), true));
            HttpAddressBinding binding            = (base.Port == null) ? null : ((HttpAddressBinding)base.Port.Extensions.Find(typeof(HttpAddressBinding)));
            string             url                = (binding != null) ? binding.Location : null;
            ServiceDescription serviceDescription = base.Binding.ServiceDescription;

            ProtocolImporterUtil.GenerateConstructorStatements(ctor, url, serviceDescription.AppSettingUrlKey, serviceDescription.AppSettingBaseUrl, false);
            this.codeClasses.Add(codeClass);
            return(codeClass);
        }