Code:
/ DotNET / DotNET / 8.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
- SessionStateUtil.cs
- SequentialWorkflowHeaderFooter.cs
- ControlTemplate.cs
- SupportedAddressingMode.cs
- TrackingDataItemValue.cs
- IERequestCache.cs
- PositiveTimeSpanValidator.cs
- GiveFeedbackEventArgs.cs
- AttributeQuery.cs
- COM2PropertyBuilderUITypeEditor.cs
- CodeDomSerializationProvider.cs
- ToolStripControlHost.cs
- Roles.cs
- MachineKeyConverter.cs
- CompilationAssemblyInstallComponent.cs
- FunctionOverloadResolver.cs
- MDIControlStrip.cs
- BoundColumn.cs
- HitTestWithPointDrawingContextWalker.cs
- DictionaryEditChange.cs
- ChildTable.cs
- WebBrowserEvent.cs
- CodeExporter.cs
- NumericExpr.cs
- TypeInfo.cs
- BinaryUtilClasses.cs
- ListControlDesigner.cs
- ChineseLunisolarCalendar.cs
- _BaseOverlappedAsyncResult.cs
- DataException.cs
- Calendar.cs
- RenderCapability.cs
- WebPartTransformer.cs
- ObjectConverter.cs
- SingleConverter.cs
- ProfileSection.cs
- SqlNodeAnnotation.cs
- AnimatedTypeHelpers.cs
- GrowingArray.cs
- TextAdaptor.cs
- XmlArrayItemAttributes.cs
- Merger.cs
- ErrorItem.cs
- System.Data_BID.cs
- PromptBuilder.cs
- ScalarConstant.cs
- MailWebEventProvider.cs
- ExtractorMetadata.cs
- isolationinterop.cs
- PrintPreviewGraphics.cs
- Span.cs
- Slider.cs
- RenamedEventArgs.cs
- ActiveXHost.cs
- ImageBrush.cs
- ParseElement.cs
- CodeValidator.cs
- __FastResourceComparer.cs
- Application.cs
- RangeBaseAutomationPeer.cs
- ImportRequest.cs
- HyperLink.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- DragDropManager.cs
- DataGridCheckBoxColumn.cs
- CmsUtils.cs
- InputBindingCollection.cs
- HandleCollector.cs
- Region.cs
- OracleParameterBinding.cs
- BuildProvider.cs
- HtmlToClrEventProxy.cs
- GeneralTransform3D.cs
- CharEntityEncoderFallback.cs
- PrimaryKeyTypeConverter.cs
- path.cs
- ProfileGroupSettings.cs
- ParameterRetriever.cs
- TransactionScope.cs
- GlyphElement.cs
- EditorBrowsableAttribute.cs
- PathFigure.cs
- LeafCellTreeNode.cs
- XmlILAnnotation.cs
- AccessViolationException.cs
- WebConfigurationFileMap.cs
- CalloutQueueItem.cs
- CodeCastExpression.cs
- ReadOnlyDictionary.cs
- TypeDescriptor.cs
- FixedSOMFixedBlock.cs
- DataSetViewSchema.cs
- TemplateField.cs
- DataGridRelationshipRow.cs
- PageCache.cs
- UnitySerializationHolder.cs
- AuthenticationSection.cs
- SynchronizedInputHelper.cs
- BehaviorEditorPart.cs
- ZoneIdentityPermission.cs