Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Compilation / WsdlBuildProvider.cs / 1305376 / 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. // //----------------------------------------------------------------------------- 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GlyphInfoList.cs
- HtmlInputSubmit.cs
- BitmapEffectInput.cs
- CultureTable.cs
- SmiMetaData.cs
- ClientTargetSection.cs
- FreeFormDesigner.cs
- ObjectViewEntityCollectionData.cs
- SHA256Managed.cs
- StringFormat.cs
- SapiInterop.cs
- StrongBox.cs
- CodeCatchClause.cs
- AttributeUsageAttribute.cs
- DescendantOverDescendantQuery.cs
- Repeater.cs
- DelegateSerializationHolder.cs
- ADRoleFactoryConfiguration.cs
- DataColumnMapping.cs
- KeySpline.cs
- WindowAutomationPeer.cs
- TextRenderer.cs
- BindingNavigator.cs
- CacheChildrenQuery.cs
- Fonts.cs
- BackStopAuthenticationModule.cs
- StyleSelector.cs
- XmlTextEncoder.cs
- RuleAction.cs
- TCEAdapterGenerator.cs
- TlsnegoTokenProvider.cs
- AsymmetricAlgorithm.cs
- HeaderedItemsControl.cs
- BitmapImage.cs
- ConfigurationPermission.cs
- namescope.cs
- ASCIIEncoding.cs
- RawStylusInputCustomData.cs
- DeclarativeCatalogPart.cs
- SortKey.cs
- VsPropertyGrid.cs
- BindingCompleteEventArgs.cs
- Image.cs
- Binding.cs
- DPAPIProtectedConfigurationProvider.cs
- SHA1CryptoServiceProvider.cs
- DockProviderWrapper.cs
- EventMappingSettingsCollection.cs
- NetStream.cs
- PointLight.cs
- Msmq3PoisonHandler.cs
- SqlNode.cs
- SqlTriggerAttribute.cs
- DecoderReplacementFallback.cs
- WebAdminConfigurationHelper.cs
- InstancePersistenceEvent.cs
- PackageFilter.cs
- RectangleF.cs
- BreakRecordTable.cs
- MemberProjectedSlot.cs
- UniqueIdentifierService.cs
- DataServiceCollectionOfT.cs
- XomlCompilerParameters.cs
- CompleteWizardStep.cs
- TextParagraph.cs
- InvalidOleVariantTypeException.cs
- RestClientProxyHandler.cs
- SQLRoleProvider.cs
- XPathParser.cs
- SettingsAttributes.cs
- AQNBuilder.cs
- Memoizer.cs
- DataSvcMapFile.cs
- SecurityKeyEntropyMode.cs
- SocketElement.cs
- UInt16Converter.cs
- Base64Encoder.cs
- SystemIPAddressInformation.cs
- FunctionMappingTranslator.cs
- Form.cs
- ErrorLog.cs
- FormatException.cs
- _Semaphore.cs
- MenuAdapter.cs
- ConditionalDesigner.cs
- EntityTypeEmitter.cs
- CachedBitmap.cs
- DrawListViewItemEventArgs.cs
- TextRangeBase.cs
- RadialGradientBrush.cs
- TemplateBindingExtensionConverter.cs
- MessageQueueInstaller.cs
- MethodCallConverter.cs
- UTF32Encoding.cs
- OleDbInfoMessageEvent.cs
- ClientFormsIdentity.cs
- BuildProvidersCompiler.cs
- XmlSchemaSearchPattern.cs
- ManagementScope.cs
- SerializationFieldInfo.cs