Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / System.ServiceModel.Activation / System / ServiceModel / Activation / ServiceRoute.cs / 1305376 / ServiceRoute.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Activation { using System; using System.Globalization; using System.Web.Routing; public class ServiceRoute : Route { internal const string LeftCurlyBracket = "{"; internal const string RightCurlyBracket = "}"; internal const string UnmatchedPathSegment = "{*pathInfo}"; internal const char PathSeperator = '/'; public ServiceRoute(string routePrefix, ServiceHostFactoryBase serviceHostFactory, Type serviceType) : base(CheckAndCreateRouteString(routePrefix), new ServiceRouteHandler(routePrefix, serviceHostFactory, serviceType)) { if (TD.AspNetRouteIsEnabled()) { TD.AspNetRoute(routePrefix, serviceType.AssemblyQualifiedName, serviceHostFactory.GetType().AssemblyQualifiedName); } } static string CheckAndCreateRouteString(string routePrefix) { // aspnet routing integration is supported only under aspnet compat mode ServiceHostingEnvironment.EnsureInitialized(); if (!ServiceHostingEnvironment.AspNetCompatibilityEnabled) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.Hosting_RouteServiceRequiresCompatibilityMode)); } // we support emptystring as routeprfix as aspnet allows it if (routePrefix == null) { throw FxTrace.Exception.ArgumentNull("routePrefix"); } else if (routePrefix.Contains(LeftCurlyBracket) || routePrefix.Contains(RightCurlyBracket)) { throw FxTrace.Exception.Argument("routePrefix", SR.Hosting_CurlyBracketFoundInRoutePrefix("{", "}")); } if(routePrefix.EndsWith(PathSeperator.ToString(), StringComparison.CurrentCultureIgnoreCase) || routePrefix.Equals(String.Empty, StringComparison.CurrentCultureIgnoreCase)) { routePrefix = string.Format(CultureInfo.CurrentCulture, "{0}{1}", routePrefix, UnmatchedPathSegment); } else { routePrefix = string.Format(CultureInfo.CurrentCulture, "{0}/{1}", routePrefix, UnmatchedPathSegment); } return routePrefix; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Activation { using System; using System.Globalization; using System.Web.Routing; public class ServiceRoute : Route { internal const string LeftCurlyBracket = "{"; internal const string RightCurlyBracket = "}"; internal const string UnmatchedPathSegment = "{*pathInfo}"; internal const char PathSeperator = '/'; public ServiceRoute(string routePrefix, ServiceHostFactoryBase serviceHostFactory, Type serviceType) : base(CheckAndCreateRouteString(routePrefix), new ServiceRouteHandler(routePrefix, serviceHostFactory, serviceType)) { if (TD.AspNetRouteIsEnabled()) { TD.AspNetRoute(routePrefix, serviceType.AssemblyQualifiedName, serviceHostFactory.GetType().AssemblyQualifiedName); } } static string CheckAndCreateRouteString(string routePrefix) { // aspnet routing integration is supported only under aspnet compat mode ServiceHostingEnvironment.EnsureInitialized(); if (!ServiceHostingEnvironment.AspNetCompatibilityEnabled) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.Hosting_RouteServiceRequiresCompatibilityMode)); } // we support emptystring as routeprfix as aspnet allows it if (routePrefix == null) { throw FxTrace.Exception.ArgumentNull("routePrefix"); } else if (routePrefix.Contains(LeftCurlyBracket) || routePrefix.Contains(RightCurlyBracket)) { throw FxTrace.Exception.Argument("routePrefix", SR.Hosting_CurlyBracketFoundInRoutePrefix("{", "}")); } if(routePrefix.EndsWith(PathSeperator.ToString(), StringComparison.CurrentCultureIgnoreCase) || routePrefix.Equals(String.Empty, StringComparison.CurrentCultureIgnoreCase)) { routePrefix = string.Format(CultureInfo.CurrentCulture, "{0}{1}", routePrefix, UnmatchedPathSegment); } else { routePrefix = string.Format(CultureInfo.CurrentCulture, "{0}/{1}", routePrefix, UnmatchedPathSegment); } return routePrefix; } } } // 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
- TextContainerChangedEventArgs.cs
- NavigationWindowAutomationPeer.cs
- EmissiveMaterial.cs
- UIElement.cs
- DetailsViewUpdateEventArgs.cs
- coordinator.cs
- BindingContext.cs
- MethodSet.cs
- ReflectionUtil.cs
- ScriptReferenceBase.cs
- ButtonAutomationPeer.cs
- PropertiesTab.cs
- GetChildSubtree.cs
- TableCellCollection.cs
- Closure.cs
- SqlRewriteScalarSubqueries.cs
- NativeMethods.cs
- ColorComboBox.cs
- InternalRelationshipCollection.cs
- WebPartConnectionsCloseVerb.cs
- SafePointer.cs
- XmlTypeAttribute.cs
- exports.cs
- TextRenderer.cs
- Tile.cs
- _SafeNetHandles.cs
- ObjectManager.cs
- SimpleHandlerFactory.cs
- PartialArray.cs
- TdsParserSafeHandles.cs
- ProviderSettingsCollection.cs
- XPathExpr.cs
- CollectionCodeDomSerializer.cs
- DriveNotFoundException.cs
- ExpressionContext.cs
- TextElementCollectionHelper.cs
- CodeDOMProvider.cs
- FormsIdentity.cs
- EventSinkActivity.cs
- SafeCryptoHandles.cs
- AnnotationAuthorChangedEventArgs.cs
- BitmapEffectInputData.cs
- SafeEventLogReadHandle.cs
- BufferBuilder.cs
- CompareValidator.cs
- PackageDigitalSignatureManager.cs
- _NestedSingleAsyncResult.cs
- StartUpEventArgs.cs
- Matrix3D.cs
- ControlUtil.cs
- DataTemplateKey.cs
- DataGridViewElement.cs
- ScriptManagerProxy.cs
- UriParserTemplates.cs
- DataServiceConfiguration.cs
- ScriptingSectionGroup.cs
- HtmlInputHidden.cs
- SingleKeyFrameCollection.cs
- LineGeometry.cs
- ControlLocalizer.cs
- __Filters.cs
- TextDecorationCollection.cs
- PropertyMetadata.cs
- KeyFrames.cs
- EntityViewGenerationAttribute.cs
- EdmItemCollection.cs
- RegionInfo.cs
- CellTreeNode.cs
- TypedTableGenerator.cs
- DBSqlParserTableCollection.cs
- SqlDataReaderSmi.cs
- NameValuePermission.cs
- wgx_exports.cs
- UnsafeNativeMethodsTablet.cs
- DataKey.cs
- ProgressBar.cs
- SecUtil.cs
- IImplicitResourceProvider.cs
- WeakReferenceEnumerator.cs
- MailMessage.cs
- GAC.cs
- ValidationSummary.cs
- ConfigurationSection.cs
- PropertyTabAttribute.cs
- DiscoveryOperationContextExtension.cs
- ElementNotEnabledException.cs
- DiscoveryInnerClientAdhocCD1.cs
- CounterSample.cs
- X509ChainPolicy.cs
- NullableFloatMinMaxAggregationOperator.cs
- DbParameterHelper.cs
- MouseGesture.cs
- HierarchicalDataTemplate.cs
- AssemblyResourceLoader.cs
- TreeNode.cs
- FileUpload.cs
- Hex.cs
- ColorTransformHelper.cs
- DataGridTablesFactory.cs
- ListViewGroup.cs