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
- XamlSerializer.cs
- SubpageParaClient.cs
- MemoryResponseElement.cs
- ErrorFormatter.cs
- Attributes.cs
- DelegatingTypeDescriptionProvider.cs
- PermissionListSet.cs
- DataFormats.cs
- GridViewItemAutomationPeer.cs
- OdbcInfoMessageEvent.cs
- RuleAttributes.cs
- SQLInt64.cs
- TrackingProfile.cs
- SectionInput.cs
- TextRunCache.cs
- ProfileBuildProvider.cs
- DataObjectMethodAttribute.cs
- filewebresponse.cs
- MemberInfoSerializationHolder.cs
- DBConnection.cs
- StringFreezingAttribute.cs
- HeaderedContentControl.cs
- Lock.cs
- BuildResult.cs
- PropertyContainer.cs
- QilChoice.cs
- RSACryptoServiceProvider.cs
- CharacterBufferReference.cs
- ConfigurationErrorsException.cs
- XPathDescendantIterator.cs
- DataGridViewDesigner.cs
- ServiceModelEnumValidatorAttribute.cs
- DispatcherObject.cs
- translator.cs
- XamlWriter.cs
- ExecutedRoutedEventArgs.cs
- RoutingExtensionElement.cs
- ITreeGenerator.cs
- PointCollectionConverter.cs
- OleDbParameterCollection.cs
- ConfigurationProperty.cs
- DictionaryManager.cs
- ConfigurationStrings.cs
- ConfigurationException.cs
- PasswordBoxAutomationPeer.cs
- WpfWebRequestHelper.cs
- VisualStyleElement.cs
- PersonalizationStateInfo.cs
- ExpressionPrinter.cs
- QueryExpression.cs
- ShortcutKeysEditor.cs
- WebPartEditorCancelVerb.cs
- PrimaryKeyTypeConverter.cs
- InputScopeNameConverter.cs
- DataGridViewCellPaintingEventArgs.cs
- CharacterBuffer.cs
- ItemDragEvent.cs
- DataRowCollection.cs
- AdjustableArrowCap.cs
- ManagementException.cs
- DataRowView.cs
- StateItem.cs
- ArraySubsetEnumerator.cs
- DataMemberConverter.cs
- NamedElement.cs
- BinarySecretSecurityToken.cs
- WindowsBrush.cs
- PageThemeParser.cs
- UnionCqlBlock.cs
- DebugView.cs
- HttpModuleAction.cs
- _ContextAwareResult.cs
- OrthographicCamera.cs
- IconHelper.cs
- GraphicsState.cs
- InstanceContext.cs
- StrongName.cs
- ArrayList.cs
- Paragraph.cs
- XPathException.cs
- DateTimeUtil.cs
- DescendantQuery.cs
- QueryOptionExpression.cs
- ImmutableObjectAttribute.cs
- FontSourceCollection.cs
- SecureEnvironment.cs
- CfgParser.cs
- complextypematerializer.cs
- RuntimeConfigurationRecord.cs
- SoapException.cs
- AnnotationAuthorChangedEventArgs.cs
- XmlSchemaSimpleType.cs
- CompiledELinqQueryState.cs
- IMembershipProvider.cs
- AddInContractAttribute.cs
- FrameworkElement.cs
- Pair.cs
- SqlDataSourceCommandEventArgs.cs
- ReturnEventArgs.cs
- WebDisplayNameAttribute.cs