Breaking changes

Coordinator
Feb 16, 2010 at 5:44 PM
Edited Feb 16, 2010 at 5:45 PM
  • [Route] attribute will be renamed to [Url]
  • [RouteDefautl] and [RouteConstraint] attributes deleted
  • New [Page] attribute added which allows you assign PageID and or Page Title, Description for a particular Action Method.

Samples of [Url] attribute usage:

 

// category is an optional parameter
[Url("store/{category?}")]
public ActionResult ProductsNew(string category = null)
{
    return View();
}

[Url("store/products/create")]
public ActionResult ProductsCreate()
{
    return View();
}

// regular expression constraint provided for the "id" parameter
[Url("store/products/edit/{id}", null, "id=[0-9]+")]
public ActionResult ProductsEdit(int id)
{
    return View();
}

Samples of [Page] attribute usage:

 

[Page("e10eb408-8f17-4ee3-ab11-28617ceffd6e")]
public ActionResult Home()
{
    return View();
}

[Page("e10eb408-8f17-4ee3-ab11-28617ceffd6e", "Admin Control Panel")]
public ActionResult Home()
{
    return View();
}

[Page("e10eb408-8f17-4ee3-ab11-28617ceffd6e", "Online Store", "Apparel, Books, DVDs online store.")]
public ActionResult Home()
{
    return View();
}

 

 

 

 

 

Apr 7, 2010 at 3:14 PM

Url clashes with UrlAttribute in System.Runtime.Remoting.Activation

I prefer RouteUrl or UrlRoute

Coordinator
Apr 7, 2010 at 4:25 PM
Yep, makes sence. Thanks for the feedback.