Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / 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
- NumberSubstitution.cs
- XPathBuilder.cs
- IdentityModelDictionary.cs
- MachineSettingsSection.cs
- TextRange.cs
- WindowsStatic.cs
- ScriptControl.cs
- DataGridViewLinkCell.cs
- IndependentAnimationStorage.cs
- ImageIndexConverter.cs
- InkSerializer.cs
- TcpDuplicateContext.cs
- KeyValueSerializer.cs
- TaiwanLunisolarCalendar.cs
- ECDsaCng.cs
- PasswordBoxAutomationPeer.cs
- XmlSortKey.cs
- EdmPropertyAttribute.cs
- BitmapScalingModeValidation.cs
- Cursor.cs
- Properties.cs
- RowCache.cs
- TextStore.cs
- ObjectContextServiceProvider.cs
- StreamingContext.cs
- HGlobalSafeHandle.cs
- UnsafeNativeMethods.cs
- HostingEnvironment.cs
- GroupBox.cs
- ExpressionLexer.cs
- WinEventQueueItem.cs
- XPathNavigatorKeyComparer.cs
- FrameSecurityDescriptor.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ValidatorCollection.cs
- ConfigurationProperty.cs
- AdapterDictionary.cs
- AnnotationDocumentPaginator.cs
- CurrencyWrapper.cs
- CompilerTypeWithParams.cs
- DocumentOutline.cs
- RecognitionEventArgs.cs
- StyleModeStack.cs
- FileLevelControlBuilderAttribute.cs
- XPathEmptyIterator.cs
- ChineseLunisolarCalendar.cs
- HtmlLiteralTextAdapter.cs
- DesignerAdapterAttribute.cs
- MenuItemBinding.cs
- BaseCodeDomTreeGenerator.cs
- XmlChildNodes.cs
- ExpressionLink.cs
- Membership.cs
- GeneralTransform3DGroup.cs
- SoapFormatExtensions.cs
- RequestCachingSection.cs
- MetadataArtifactLoaderCompositeFile.cs
- TypeElementCollection.cs
- PrePrepareMethodAttribute.cs
- DataGridRow.cs
- SystemInfo.cs
- BinaryNode.cs
- WaveHeader.cs
- MetadataSource.cs
- SqlUDTStorage.cs
- EmptyEnumerator.cs
- SoapFormatterSinks.cs
- XmlElementList.cs
- DataServiceSaveChangesEventArgs.cs
- WindowsToolbarAsMenu.cs
- GeneralTransformGroup.cs
- Configuration.cs
- SymmetricKeyWrap.cs
- Pointer.cs
- CleanUpVirtualizedItemEventArgs.cs
- DataGridViewCellValidatingEventArgs.cs
- StaticFileHandler.cs
- Journal.cs
- PersonalizationStateInfo.cs
- NativeWindow.cs
- GenericsInstances.cs
- PublisherIdentityPermission.cs
- ToolboxDataAttribute.cs
- HttpHandler.cs
- HtmlTextArea.cs
- OdbcStatementHandle.cs
- PerformanceCounterLib.cs
- Serializer.cs
- AxDesigner.cs
- LayoutEvent.cs
- CodeChecksumPragma.cs
- BrowserDefinition.cs
- AttributeQuery.cs
- EntityTypeBase.cs
- PageThemeCodeDomTreeGenerator.cs
- UnsafeNativeMethods.cs
- SystemInfo.cs
- ValidationService.cs
- ResourceContainer.cs
- ApplicationCommands.cs