本文整理汇总了C#中IRouteHandler类的典型用法代码示例。如果您正苦于以下问题:C# IRouteHandler类的具体用法?C# IRouteHandler怎么用?C# IRouteHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRouteHandler类属于命名空间,在下文中一共展示了IRouteHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RewriteLowerCaseUrlRoute
/// <summary>
/// 初始化一个<see cref="RewriteLowerCaseUrlRoute"/>类的新实例
/// </summary>
/// <param name="url"> </param>
/// <param name="defaults"> </param>
/// <param name="constraints"> </param>
/// <param name="dataTokens"> </param>
/// <param name="routeHandler"> </param>
public RewriteLowerCaseUrlRoute(string url,
RouteValueDictionary defaults,
RouteValueDictionary constraints,
RouteValueDictionary dataTokens,
IRouteHandler routeHandler)
: base(url, defaults, constraints, dataTokens, routeHandler)
{ }
示例2: UIRoute
/// <summary>
/// Initializes a new instance of the <see cref="UIRoute"/> class.
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="defaults">The defaults.</param>
/// <param name="routeHandler">The route handler.</param>
public UIRoute(string url, RouteValueDictionary defaults, IRouteHandler routeHandler)
: base(url, defaults, routeHandler)
{
_url = url;
_defaults = defaults;
_routeHandler = routeHandler;
}
示例3: MapRoute
public static void MapRoute(this RouteCollection routes, string name, string url, object defaults, object constraints, IRouteHandler routeHandler)
{
var newRoute = new NamedRoute(name, url, routeHandler);
newRoute.Defaults = new RouteValueDictionary(defaults);
newRoute.Constraints = new RouteValueDictionary(constraints);
routes.Add(name, newRoute);
}
示例4: GetRequestContext
static Mock<RequestContext> GetRequestContext(string requestUrl, string routeUrl, IRouteHandler handler)
{
var route = new Route(routeUrl, handler);
var sv = new Mock<NameValueCollection>(MockBehavior.Strict);
sv.Setup(m => m.Get("IIS_UrlRewriteModule")).Returns((string)null);
var req = new Mock<HttpRequestBase>(MockBehavior.Strict);
req.Setup(m => m.AppRelativeCurrentExecutionFilePath).Returns("~/");
req.Setup(m => m.PathInfo).Returns(requestUrl);
req.Setup(m => m.ApplicationPath).Returns("/");
req.Setup(m => m.ServerVariables).Returns(sv.Object);
var resp = new Mock<HttpResponseBase>(MockBehavior.Strict);
resp.Setup(m => m.ApplyAppPathModifier(It.IsAny<string>())).Returns<string>(url => url);
var ctx = new Mock<HttpContextBase>(MockBehavior.Strict);
ctx.Setup(m => m.Request).Returns(req.Object);
ctx.Setup(m => m.Response).Returns(resp.Object);
var reqCtx = new Mock<RequestContext>(MockBehavior.Strict);
reqCtx.Setup(m => m.HttpContext).Returns(ctx.Object);
reqCtx.Setup(m => m.RouteData).Returns(route.GetRouteData(ctx.Object));
return reqCtx;
}
示例5: CultureSensitiveRouteHandler
public CultureSensitiveRouteHandler(IRouteHandler routeHandler)
{
RouteHandler = routeHandler;
SetCurrentCulture = true;
SetCurrentUICulture = true;
}
示例6: SimpleRouteTable
/// <summary>
/// 创建一个简单路由表实例
/// </summary>
/// <param name="name">简单路由表名称</param>
/// <param name="handler">处理路由请求的对象</param>
/// <param name="mvcCompatible">是否产生MVC兼容的虚拟路径(去除~/)</param>
public SimpleRouteTable( string name, IRouteHandler handler, bool mvcCompatible )
{
Name = name;
Handler = handler;
MvcCompatible = mvcCompatible;
UrlEncoding = Encoding.UTF8;
}
示例7: ContentNegotiationRouteProxy
/// <summary>
/// Creates a new ContentNegotiationRouteProxy.
/// </summary>
/// <param name="proxiedHandler">The handler to proxy, typically an MvcRouteHandler</param>
/// <param name="map">The map containing the associations between media types and formats</param>
/// <param name="priority">Whether the client sets the priority or the server. The HTTP spec
/// indicates that the client should set it, but on occasion the server may need to set it
/// to work around bugs in browsers (e.g. Chrome prioritizes xml over html).</param>
public ContentNegotiationRouteProxy(IRouteHandler proxiedHandler, MediaTypeFormatMap map,
ConnegPriorityGivenTo priority = ConnegPriorityGivenTo.Client)
{
this.proxiedHandler = proxiedHandler;
this.map = map;
this.priority = priority;
}
示例8: TranslationRoute
public TranslationRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints,
RouteValueDictionary dataTokens, IRouteHandler routeHandler)
: base(url, defaults, constraints, dataTokens, routeHandler)
{
TranslationRouteRoot = this;
TranslatedRoutes = new Dictionary<string, TranslationRoute>();
}
示例9: ShortyRoute
public ShortyRoute(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler)
: base(url, defaults, constraints, dataTokens, routeHandler)
{
if (string.IsNullOrEmpty(url)) throw new ArgumentNullException("Route url must be defined", "url");
var thisUrl = url;
}
示例10: Route
public Route(string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler routeHandler) {
Url = url;
Defaults = defaults;
Constraints = constraints;
DataTokens = dataTokens;
RouteHandler = routeHandler;
}
示例11: LocaleRoute
public LocaleRoute(
string pattern,
RouteValueDictionary defaults,
RouteValueDictionary constraints,
RouteValueDictionary tokens,
string[] namespaces,
IRouteHandler routeHandler)
{
var localeConstraints = new RouteValueDictionary(constraints);
localeConstraints.Add("locale", @"[a-zA-Z]{2}");
_routeWithLocale = new Route(
@"{locale}/" + pattern,
defaults,
localeConstraints,
tokens,
new LocaleRouteHandler(routeHandler));
_routeWithoutLocale = new Route(
pattern,
defaults,
constraints,
tokens,
new LocaleRouteHandler(routeHandler));
if(namespaces != null && namespaces.Any()) {
_routeWithLocale.DataTokens["Namespaces"] = namespaces;
_routeWithoutLocale.DataTokens["Namespaces"] = namespaces;
}
}
示例12: NamedRoute
public NamedRoute(string name, string displayName, string url, RouteValueDictionary defaults, RouteValueDictionary constraints,
RouteValueDictionary dataTokens, IRouteHandler routeHandler)
: base(url, defaults, constraints, dataTokens, routeHandler)
{
_name = name;
_displayName = displayName;
}
示例13: PortalableRoute
public PortalableRoute(string url, RouteValueDictionary constraints, IRouteHandler routeHandler)
: base(url, null, constraints, routeHandler)
{
//Url = url;
//Constraints = constraints;
//RouteHandler = routeHandler;
}
示例14: KarbonRoute
/// <summary>
/// Initializes a new instance of the <see cref="KarbonRoute"/> class.
/// </summary>
/// <param name="url">The URL pattern for the route.</param>
/// <param name="routeHandler">The object that processes requests for the route.</param>
public KarbonRoute(string url,
IRouteHandler routeHandler)
: base(url, routeHandler)
{
_url = url;
_routeHandler = routeHandler;
}
示例15: RouteData
public RouteData(RouteBase route, IRouteHandler routeHandler)
{
this._values = new RouteValueDictionary();
this._dataTokens = new RouteValueDictionary();
this.Route = route;
this.RouteHandler = routeHandler;
}