本文整理汇总了C#中RouteCollection.MapAttributeRoutes方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapAttributeRoutes方法的具体用法?C# RouteCollection.MapAttributeRoutes怎么用?C# RouteCollection.MapAttributeRoutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.MapAttributeRoutes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapAttributeRoutes();
}
示例2: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// Note: All routes should be handled by the RouteAttribute on each action
routes.MapAttributeRoutes(config => config.AddRoutesFromAssemblyOf<RouteConfig>());
}
示例3: Setup
public void Setup()
{
assertEngine = new FakeAssertEngine();
RouteAssert.UseAssertEngine(assertEngine);
routes = new RouteCollection();
routes.MapAttributeRoutes(c => c.AddRoutesFromController<HomeAttrController>());
}
示例4: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapAttributeRoutes();
routes.MapHttpAttributeRoutes();
}
示例5: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapAttributeRoutes(config =>
{
config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
config.UseLowercaseRoutes = true;
config.PreserveCaseForUrlParameters = true;
});
}
示例6: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapAttributeRoutes();
}
示例7: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapAttributeRoutes(config =>
{
config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
config.AutoGenerateRouteNames = true;
});
}
示例8: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapAttributeRoutes(config =>
{
config.UseLowercaseRoutes = true;
config.PreserveCaseForUrlParameters = true;
});
}
示例9: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapAttributeRoutes();
routes.MapRoute(
"CatchAllRoute",
"{*url}",
new { controller = "Error", action = "CatchAll" }
);
}
示例10: RegisterAttributeRoutes
private static void RegisterAttributeRoutes(RouteCollection routes)
{
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapAttributeRoutes(config =>
{
config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
config.AddRoutesFromAssemblyOf<SearchLayer>();
//config.AddRoutesFromAssemblyOf<YourCustomLayer>();
config.UseLowercaseRoutes = true;
});
}
示例11: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapAttributeRoutes(config =>
{
config.ScanAssembly(Assembly.GetExecutingAssembly());
config.UseLowercaseRoutes = true;
});
}
示例12: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapAttributeRoutes(config=>
{
config.ScanAssemblyOf<MvcApplication>();
config.UseLowercaseRoutes = true;
config.AppendTrailingSlash = true;
});
routes.MapRoute("CatchAll", "{*path}", new { controller = "Error", action = "FileNotFound" });
}
示例13: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
//
routes.IgnoreRoute("elmah.axd");
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
//Skip static files
routes.IgnoreRoute("{*staticfile}", new { staticfile = @".*\.(jpg|gif|jpeg|png|css|js)$" });
// See http://github.com/mccalltd/AttributeRouting/wiki/3.-Configuration for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapAttributeRoutes(config =>
{
config.ScanAssembly(Assembly.GetExecutingAssembly());
config.AutoGenerateRouteNames = true; //Essential for duplicate actions with GET and POST or same action with both GET POST
//IMPORTANT: don't use the following or else it will do redirects and remove port number which won't work with AppHarbor
config.UseLowercaseRoutes = false;
config.AddDefaultRouteConstraint(@"^id$", new RegexRouteConstraint(@"^\d+$"));
});
//
// DON'T DELETE THE FOLLOWING
//
//This is essential for:
// -Letting domain.com open default action
// -When generating urls with T4MVC for actions that contain parameters but we expect the path to be empty
// Example:
// For MyController.GetUpdates(long id), Url.Action(MVC.My.GetUpdates()) will result in an empty string instead of "/my/getupdates"
// It doesnt matter if the controller is decorated with [GET("GetUpdates/{id}")] or [POST("GetUpdates/{id}")]
//routes.MapRoute(
// "Default_app", // Route name
// "App/{pageid}/{controller}/{action}/{id}", // URL with parameters
// new { pageid = "0", controller = "Home", action = "index", id = UrlParameter.Optional },
// new string[] {"SocialFruits.Controllers"} // Parameter defaults
//);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
MVC.Home.Index(),
new { id = UrlParameter.Optional }, // Parameter defaults
new string[] { "SocialFruits.Controllers" }
);
////Catch reamining routes
//routes.MapRoute("catch-all", "{*catchall}", MVC.Error.NotFound(),
// new string[] { "SocialFruits.Controllers" }
// );
}
示例14: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapAttributeRoutes(config =>
{
config.ScanAssemblyOf<ControllerBase>();
config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
});
routes.MapRoute("CatchAll",
"{*path}",
new { controller = "home", action = "filenotfound" },
new[] { typeof(HomeController).Namespace });
}
示例15: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
routes.MapAttributeRoutes(
config =>
{
config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
config.AddRoutesFromControllersOfType<Controller>();
//config.UseLowercaseRoutes = true;
config.DefaultSubdomain = "admin";
config.MapArea("Admin").ToSubdomain("admin");
}
);
}