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
- ClientConfigurationSystem.cs
- DuplicateWaitObjectException.cs
- QueryOptionExpression.cs
- PathStreamGeometryContext.cs
- Pointer.cs
- ShaderRenderModeValidation.cs
- FrameDimension.cs
- XmlSchemaInclude.cs
- StringUtil.cs
- OutputWindow.cs
- FileSystemWatcher.cs
- SettingsPropertyWrongTypeException.cs
- XmlElement.cs
- TextEndOfSegment.cs
- PointUtil.cs
- NativeRightsManagementAPIsStructures.cs
- LowerCaseStringConverter.cs
- InkCanvasSelection.cs
- WebPartConnectionsCancelVerb.cs
- Vector3dCollection.cs
- TerminatorSinks.cs
- Command.cs
- PageThemeBuildProvider.cs
- ParameterToken.cs
- ADRoleFactory.cs
- HMACSHA256.cs
- WebControlsSection.cs
- DefaultShape.cs
- PropertySourceInfo.cs
- TimeZone.cs
- _ProxyChain.cs
- WebInvokeAttribute.cs
- TypeLibConverter.cs
- MeasureItemEvent.cs
- AssertFilter.cs
- CompositeDesignerAccessibleObject.cs
- Command.cs
- WebPartConnectionCollection.cs
- xsdvalidator.cs
- GB18030Encoding.cs
- EntityDataSourceStatementEditor.cs
- EntityWithChangeTrackerStrategy.cs
- Canvas.cs
- PtsCache.cs
- DesignerCategoryAttribute.cs
- SystemIcons.cs
- Vector3DIndependentAnimationStorage.cs
- WebHttpDispatchOperationSelector.cs
- XmlWrappingReader.cs
- SchemaCollectionPreprocessor.cs
- WriteTimeStream.cs
- CodeDirectoryCompiler.cs
- StreamGeometryContext.cs
- BitmapSizeOptions.cs
- CodeDomSerializationProvider.cs
- VirtualizingStackPanel.cs
- SHA1Managed.cs
- ReflectEventDescriptor.cs
- Panel.cs
- TreeNode.cs
- TraceContextRecord.cs
- Triangle.cs
- ValueExpressions.cs
- SoapAttributeAttribute.cs
- brushes.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- JpegBitmapEncoder.cs
- RawKeyboardInputReport.cs
- iisPickupDirectory.cs
- HtmlAnchor.cs
- ToolStripProgressBar.cs
- ContextBase.cs
- ConfigXmlAttribute.cs
- IndicShape.cs
- HijriCalendar.cs
- SocketInformation.cs
- Line.cs
- ScriptIgnoreAttribute.cs
- DataConnectionHelper.cs
- ProfileGroupSettings.cs
- NullToBooleanConverter.cs
- EllipseGeometry.cs
- FloaterBaseParaClient.cs
- StandardToolWindows.cs
- QuadraticBezierSegment.cs
- UnmanagedMemoryAccessor.cs
- AuthenticationService.cs
- XmlAttributes.cs
- XmlSerializerOperationBehavior.cs
- IdentityHolder.cs
- RuleInfoComparer.cs
- StreamSecurityUpgradeInitiatorAsyncResult.cs
- DecimalConstantAttribute.cs
- QilSortKey.cs
- DebugTraceHelper.cs
- StatusInfoItem.cs
- DoubleConverter.cs
- AuthorizationRuleCollection.cs
- BinaryVersion.cs
- CompositeFontInfo.cs