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
- BasicHttpBindingElement.cs
- InputLanguageProfileNotifySink.cs
- LingerOption.cs
- HttpCapabilitiesSectionHandler.cs
- ServiceObjectContainer.cs
- BaseCollection.cs
- ViewStateModeByIdAttribute.cs
- ListItemParagraph.cs
- XpsFilter.cs
- HwndHost.cs
- DataGridViewRowEventArgs.cs
- CollectionBase.cs
- HandledMouseEvent.cs
- Binding.cs
- Propagator.Evaluator.cs
- DateTime.cs
- ClientTargetSection.cs
- PointConverter.cs
- PreviewKeyDownEventArgs.cs
- XmlExpressionDumper.cs
- TemplateParser.cs
- AuthenticationModulesSection.cs
- SqlNodeAnnotation.cs
- ToolStripRenderer.cs
- SqlCommand.cs
- Attributes.cs
- BasePattern.cs
- DomNameTable.cs
- SystemPens.cs
- Variant.cs
- AttributeQuery.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- InputBindingCollection.cs
- Vector3DKeyFrameCollection.cs
- ReadOnlyCollection.cs
- AnnotationHighlightLayer.cs
- XD.cs
- TextClipboardData.cs
- AutoFocusStyle.xaml.cs
- MessageContractExporter.cs
- UnsafeMethods.cs
- FixedPageProcessor.cs
- StandardCommands.cs
- RevocationPoint.cs
- _StreamFramer.cs
- ConfigurationStrings.cs
- SqlTrackingQuery.cs
- DataGridParentRows.cs
- OleDbDataAdapter.cs
- Point3DConverter.cs
- WebEvents.cs
- TextRange.cs
- ButtonBaseAdapter.cs
- SqlEnums.cs
- WindowsButton.cs
- COM2Properties.cs
- NaturalLanguageHyphenator.cs
- NativeObjectSecurity.cs
- RoleProviderPrincipal.cs
- TemplateInstanceAttribute.cs
- DependencySource.cs
- PeerNearMe.cs
- DataGridViewLinkCell.cs
- ToolStripDesignerAvailabilityAttribute.cs
- _CacheStreams.cs
- InvalidCardException.cs
- WindowsImpersonationContext.cs
- SocketInformation.cs
- MediaSystem.cs
- FromReply.cs
- GridViewUpdatedEventArgs.cs
- IconConverter.cs
- SelectionHighlightInfo.cs
- ConfigurationManagerHelperFactory.cs
- HostingPreferredMapPath.cs
- PointAnimationUsingKeyFrames.cs
- GetPageNumberCompletedEventArgs.cs
- EnterpriseServicesHelper.cs
- SecurityPolicySection.cs
- TableHeaderCell.cs
- UiaCoreApi.cs
- CompositeControl.cs
- RegisteredHiddenField.cs
- ModelToObjectValueConverter.cs
- SqlNotificationEventArgs.cs
- WebCategoryAttribute.cs
- ISAPIWorkerRequest.cs
- MachineKeySection.cs
- OracleMonthSpan.cs
- ChangeDirector.cs
- EventData.cs
- TextCompositionManager.cs
- MethodCallConverter.cs
- DataServiceQueryOfT.cs
- DescendantOverDescendantQuery.cs
- JsonFormatWriterGenerator.cs
- Context.cs
- BrowsableAttribute.cs
- TemplateXamlParser.cs
- ImageUrlEditor.cs