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
- RoutedEventValueSerializer.cs
- CodeTypeMember.cs
- RedistVersionInfo.cs
- Point3D.cs
- VariableAction.cs
- WpfSharedXamlSchemaContext.cs
- EtwTrace.cs
- EnumConverter.cs
- FixedFindEngine.cs
- versioninfo.cs
- InfoCardHelper.cs
- OraclePermissionAttribute.cs
- RuntimeCompatibilityAttribute.cs
- ObjectSerializerFactory.cs
- InputProviderSite.cs
- SyndicationElementExtension.cs
- PopupEventArgs.cs
- UserControl.cs
- PointAnimation.cs
- ProjectionPlan.cs
- ObjectSecurity.cs
- ToolStripComboBox.cs
- ChildrenQuery.cs
- TargetException.cs
- CqlParserHelpers.cs
- DbMetaDataColumnNames.cs
- NonSerializedAttribute.cs
- HttpCachePolicy.cs
- WindowsListViewScroll.cs
- Run.cs
- DataGridViewColumnCollectionEditor.cs
- safelinkcollection.cs
- RawMouseInputReport.cs
- ClipboardProcessor.cs
- BlobPersonalizationState.cs
- ExecutorLocksHeldException.cs
- WebPartCancelEventArgs.cs
- InProcStateClientManager.cs
- PagesChangedEventArgs.cs
- PanelDesigner.cs
- ListChunk.cs
- XsdDuration.cs
- ProviderIncompatibleException.cs
- CaseKeyBox.ViewModel.cs
- Vector3D.cs
- FixedPosition.cs
- RegexMatchCollection.cs
- AsymmetricKeyExchangeFormatter.cs
- OdbcInfoMessageEvent.cs
- DockPatternIdentifiers.cs
- ColorTransform.cs
- SchemaMapping.cs
- RoleGroupCollectionEditor.cs
- IERequestCache.cs
- MsmqHostedTransportManager.cs
- HostAdapter.cs
- DynamicDiscoSearcher.cs
- PolicyStatement.cs
- XmlSchemaComplexType.cs
- GiveFeedbackEventArgs.cs
- JoinTreeSlot.cs
- SwitchElementsCollection.cs
- TypeDelegator.cs
- TextAdaptor.cs
- AdornerDecorator.cs
- ProviderConnectionPointCollection.cs
- MdImport.cs
- GACIdentityPermission.cs
- XmlDataSource.cs
- XmlWellformedWriter.cs
- KeyedCollection.cs
- RepeaterCommandEventArgs.cs
- Parser.cs
- XMLUtil.cs
- NetNamedPipeBindingCollectionElement.cs
- AddingNewEventArgs.cs
- ParseChildrenAsPropertiesAttribute.cs
- DocumentViewerBase.cs
- SymbolPair.cs
- VisemeEventArgs.cs
- Binding.cs
- ImportCatalogPart.cs
- OptionalColumn.cs
- ParameterReplacerVisitor.cs
- StringUtil.cs
- KeySplineConverter.cs
- TemplateControlCodeDomTreeGenerator.cs
- URLIdentityPermission.cs
- Stylesheet.cs
- EntityUtil.cs
- DllNotFoundException.cs
- AttachedPropertyInfo.cs
- XmlByteStreamReader.cs
- RelationshipType.cs
- UICuesEvent.cs
- HtmlEncodedRawTextWriter.cs
- PasswordRecoveryDesigner.cs
- RecordBuilder.cs
- AppDomainManager.cs
- XmlEntity.cs