Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / xsp / System / Web / Compilation / WebReferencesBuildProvider.cs / 2 / WebReferencesBuildProvider.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Compilation { using System; using System.Globalization; using System.CodeDom; using System.CodeDom.Compiler; using System.Collections.Specialized; using System.Net; using System.Xml.Serialization; #if !FEATURE_PAL using System.Web.Services.Description; using System.Web.Services.Discovery; #endif // !FEATURE_PAL using System.Web.Hosting; using System.Web.UI; using System.Web.Util; using Util=System.Web.UI.Util; internal class WebReferencesBuildProvider: BuildProvider { private VirtualDirectory _vdir; private const string IndigoWebRefProviderTypeName = "System.Web.Compilation.WCFBuildProvider"; private static Type s_indigoWebRefProviderType; private static bool s_triedToGetWebRefType; internal WebReferencesBuildProvider(VirtualDirectory vdir) { _vdir = vdir; } public override void GenerateCode(AssemblyBuilder assemblyBuilder) { // Only attempt to get the Indigo provider once if (!s_triedToGetWebRefType) { s_indigoWebRefProviderType = BuildManager.GetType(IndigoWebRefProviderTypeName, false /*throwOnError*/); s_triedToGetWebRefType = true; } // If we have an Indigo provider, instantiate it and forward the GenerateCode call to it if (s_indigoWebRefProviderType != null) { BuildProvider buildProvider = (BuildProvider)HttpRuntime.CreateNonPublicInstance(s_indigoWebRefProviderType); buildProvider.SetVirtualPath(VirtualPathObject); buildProvider.GenerateCode(assemblyBuilder); } // e.g "/MyApp/Application_WebReferences" VirtualPath rootWebRefDirVirtualPath = HttpRuntime.WebRefDirectoryVirtualPath; // e.g "/MyApp/Application_WebReferences/Foo/Bar" string currentWebRefDirVirtualPath = _vdir.VirtualPath; Debug.Assert(StringUtil.StringStartsWithIgnoreCase( currentWebRefDirVirtualPath, rootWebRefDirVirtualPath.VirtualPathString)); string ns; if (rootWebRefDirVirtualPath.VirtualPathString.Length == currentWebRefDirVirtualPath.Length) { // If it's the root WebReferences dir, use the empty namespace ns = String.Empty; } else { // e.g. "Foo/Bar" Debug.Assert(rootWebRefDirVirtualPath.HasTrailingSlash); currentWebRefDirVirtualPath = UrlPath.RemoveSlashFromPathIfNeeded(currentWebRefDirVirtualPath); currentWebRefDirVirtualPath = currentWebRefDirVirtualPath.Substring( rootWebRefDirVirtualPath.VirtualPathString.Length); // Split it into chunks separated by '/' string[] chunks = currentWebRefDirVirtualPath.Split('/'); // Turn all the relevant chunks into valid namespace chunks for (int i=0; i
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- NativeMethodsOther.cs
- ISessionStateStore.cs
- BindingManagerDataErrorEventArgs.cs
- CopyNamespacesAction.cs
- CngProvider.cs
- HttpSysSettings.cs
- HtmlControlPersistable.cs
- SettingsBase.cs
- DataShape.cs
- KeyTime.cs
- Header.cs
- CancellationTokenRegistration.cs
- OdbcCommand.cs
- InvalidDataException.cs
- Compiler.cs
- TreeNodeStyleCollection.cs
- Attributes.cs
- Rule.cs
- TripleDESCryptoServiceProvider.cs
- XpsS0ValidatingLoader.cs
- ResourceProviderFactory.cs
- ConnectionPoint.cs
- EditingScopeUndoUnit.cs
- DesignTimeParseData.cs
- ProgressiveCrcCalculatingStream.cs
- StylusButtonCollection.cs
- TextFormatterImp.cs
- _AutoWebProxyScriptWrapper.cs
- LOSFormatter.cs
- StatusBarDesigner.cs
- Point3DCollection.cs
- ProbeMatches11.cs
- Debug.cs
- BindingValueChangedEventArgs.cs
- XmlIgnoreAttribute.cs
- SqlWorkflowInstanceStoreLock.cs
- InstanceData.cs
- TypeBuilder.cs
- RolePrincipal.cs
- TextFormatter.cs
- EntityDataSourceValidationException.cs
- IssuedSecurityTokenParameters.cs
- XmlUTF8TextReader.cs
- ImageFormat.cs
- SoapIncludeAttribute.cs
- CollectionChange.cs
- WriteTimeStream.cs
- ProfileService.cs
- SecureUICommand.cs
- PKCS1MaskGenerationMethod.cs
- ObjRef.cs
- DataSourceCacheDurationConverter.cs
- VirtualizedCellInfoCollection.cs
- FileResponseElement.cs
- cache.cs
- ModelTreeManager.cs
- DesignTableCollection.cs
- BinaryObjectReader.cs
- CodeNamespace.cs
- Vector3D.cs
- BinaryFormatter.cs
- JpegBitmapEncoder.cs
- WindowHideOrCloseTracker.cs
- RTLAwareMessageBox.cs
- GridView.cs
- PrimitiveType.cs
- QilChoice.cs
- PrintDialog.cs
- TraceHandler.cs
- DependencyPropertyKind.cs
- TabItem.cs
- ImageAnimator.cs
- SelectionRange.cs
- XmlChoiceIdentifierAttribute.cs
- LocationEnvironment.cs
- ModulesEntry.cs
- UrlMapping.cs
- CompiledQueryCacheEntry.cs
- WebServiceData.cs
- ListBox.cs
- XmlCodeExporter.cs
- ExtensionDataReader.cs
- ListViewCommandEventArgs.cs
- TaskFormBase.cs
- LogExtentCollection.cs
- StatusBar.cs
- SafeFileHandle.cs
- ConstraintStruct.cs
- propertyentry.cs
- EntityDataSourceWizardForm.cs
- COM2ColorConverter.cs
- ServiceOperationListItem.cs
- Model3D.cs
- OleDbDataAdapter.cs
- XmlToDatasetMap.cs
- XamlTreeBuilder.cs
- StorageModelBuildProvider.cs
- PlainXmlDeserializer.cs
- ListViewPagedDataSource.cs
- CharacterBuffer.cs