Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / Compilation / WsdlBuildProvider.cs / 1 / WsdlBuildProvider.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Compilation { using System; using System.Globalization; using System.IO; using System.Diagnostics; using System.Web.Services.Description; using System.Xml; using System.Xml.Serialization; using System.CodeDom; using System.CodeDom.Compiler; using System.Web.Configuration; using System.Web.Hosting; using System.Web.Util; using Util=System.Web.UI.Util; [BuildProviderAppliesTo(BuildProviderAppliesTo.Code)] internal class WsdlBuildProvider: BuildProvider { public override void GenerateCode(AssemblyBuilder assemblyBuilder) { // Get the namespace that we will use string ns = Util.GetNamespaceFromVirtualPath(VirtualPathObject); ServiceDescription sd; // Load the wsdl file using (Stream stream = VirtualPathObject.OpenFile()) { try { sd = ServiceDescription.Read(stream); } catch (InvalidOperationException e) { // It can throw an InvalidOperationException, with the relevant // XmlException as the inner exception. If so, throw that instead. XmlException xmlException = e.InnerException as XmlException; if (xmlException != null) throw xmlException; throw; } } ServiceDescriptionImporter importer = new ServiceDescriptionImporter(); #if !FEATURE_PAL importer.CodeGenerator = assemblyBuilder.CodeDomProvider; importer.CodeGenerationOptions = CodeGenerationOptions.GenerateProperties | CodeGenerationOptions.GenerateNewAsync | CodeGenerationOptions.GenerateOldAsync; #endif // !FEATURE_PAL importer.ServiceDescriptions.Add(sd); CodeCompileUnit codeCompileUnit = new CodeCompileUnit(); CodeNamespace codeNamespace = new CodeNamespace(ns); codeCompileUnit.Namespaces.Add(codeNamespace); // Create the code compile unit importer.Import(codeNamespace, codeCompileUnit); // Add the CodeCompileUnit to the compilation assemblyBuilder.AddCodeCompileUnit(this, codeCompileUnit); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Compilation { using System; using System.Globalization; using System.IO; using System.Diagnostics; using System.Web.Services.Description; using System.Xml; using System.Xml.Serialization; using System.CodeDom; using System.CodeDom.Compiler; using System.Web.Configuration; using System.Web.Hosting; using System.Web.Util; using Util=System.Web.UI.Util; [BuildProviderAppliesTo(BuildProviderAppliesTo.Code)] internal class WsdlBuildProvider: BuildProvider { public override void GenerateCode(AssemblyBuilder assemblyBuilder) { // Get the namespace that we will use string ns = Util.GetNamespaceFromVirtualPath(VirtualPathObject); ServiceDescription sd; // Load the wsdl file using (Stream stream = VirtualPathObject.OpenFile()) { try { sd = ServiceDescription.Read(stream); } catch (InvalidOperationException e) { // It can throw an InvalidOperationException, with the relevant // XmlException as the inner exception. If so, throw that instead. XmlException xmlException = e.InnerException as XmlException; if (xmlException != null) throw xmlException; throw; } } ServiceDescriptionImporter importer = new ServiceDescriptionImporter(); #if !FEATURE_PAL importer.CodeGenerator = assemblyBuilder.CodeDomProvider; importer.CodeGenerationOptions = CodeGenerationOptions.GenerateProperties | CodeGenerationOptions.GenerateNewAsync | CodeGenerationOptions.GenerateOldAsync; #endif // !FEATURE_PAL importer.ServiceDescriptions.Add(sd); CodeCompileUnit codeCompileUnit = new CodeCompileUnit(); CodeNamespace codeNamespace = new CodeNamespace(ns); codeCompileUnit.Namespaces.Add(codeNamespace); // Create the code compile unit importer.Import(codeNamespace, codeCompileUnit); // Add the CodeCompileUnit to the compilation assemblyBuilder.AddCodeCompileUnit(this, codeCompileUnit); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Vector3dCollection.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- FixedHyperLink.cs
- XmlUtilWriter.cs
- TextElementEnumerator.cs
- ImageListUtils.cs
- XmlSortKeyAccumulator.cs
- Messages.cs
- WebPartZone.cs
- SqlClientWrapperSmiStreamChars.cs
- TextBoxBase.cs
- DateTimeConstantAttribute.cs
- WebPartEditorOkVerb.cs
- DataColumnMappingCollection.cs
- HttpConfigurationContext.cs
- Crypto.cs
- GridLength.cs
- HScrollBar.cs
- TableColumn.cs
- PolyQuadraticBezierSegment.cs
- XMLSchema.cs
- SelectionItemProviderWrapper.cs
- DeriveBytes.cs
- UpdatePanelControlTrigger.cs
- XmlWrappingReader.cs
- TerminatorSinks.cs
- DataBoundControlHelper.cs
- SqlDelegatedTransaction.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- LinkedList.cs
- EntityContainerRelationshipSet.cs
- DefaultEvaluationContext.cs
- _ProxyChain.cs
- AccessibilityHelperForXpWin2k3.cs
- VirtualizedItemPattern.cs
- DeleteBookmarkScope.cs
- TransformedBitmap.cs
- XmlArrayItemAttributes.cs
- QilTernary.cs
- GlyphRunDrawing.cs
- CollectionContainer.cs
- AspNetCacheProfileAttribute.cs
- ReadOnlyMetadataCollection.cs
- ListViewGroupConverter.cs
- TextBoxRenderer.cs
- ProviderConnectionPointCollection.cs
- FormViewDesigner.cs
- OdbcParameterCollection.cs
- WSDualHttpBindingElement.cs
- LineGeometry.cs
- NativeMethods.cs
- SettingsPropertyValue.cs
- WorkingDirectoryEditor.cs
- DataGridViewSelectedCellCollection.cs
- CombinedTcpChannel.cs
- WebServiceErrorEvent.cs
- UpdatePanelTriggerCollection.cs
- AssemblyBuilderData.cs
- SerialReceived.cs
- SerializationSectionGroup.cs
- WeakEventTable.cs
- TextRunTypographyProperties.cs
- DbProviderFactory.cs
- MediaCommands.cs
- DataSetMappper.cs
- FontUnit.cs
- GroupQuery.cs
- DataControlFieldHeaderCell.cs
- RelOps.cs
- DataGridLinkButton.cs
- Flowchart.cs
- PagePropertiesChangingEventArgs.cs
- PersistenceTypeAttribute.cs
- Avt.cs
- ClientConfigurationHost.cs
- EdmRelationshipRoleAttribute.cs
- RegisteredHiddenField.cs
- DataSourceProvider.cs
- UxThemeWrapper.cs
- Timer.cs
- MetadataProperty.cs
- HttpException.cs
- PrePrepareMethodAttribute.cs
- DataGridTableCollection.cs
- SQLByte.cs
- AmbientLight.cs
- XmlAnyElementAttribute.cs
- XmlAnyAttributeAttribute.cs
- CallContext.cs
- RemotingConfiguration.cs
- ParameterToken.cs
- MaterializeFromAtom.cs
- Invariant.cs
- PathParser.cs
- TraversalRequest.cs
- BaseInfoTable.cs
- TemplateBindingExpressionConverter.cs
- BooleanAnimationUsingKeyFrames.cs
- ButtonColumn.cs
- PackageDigitalSignatureManager.cs