Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 4. Routes and URLs > ROUTE EXTENSIBILITY

4.4. ROUTE EXTENSIBILITY

Most of the time, you will find little need to write a custom route. However, in those rare cases that you do, the Routing API is quite flexible. At one extreme, you can toss out everything in the Route class and inherit directly from RouteBase instead. That would require that you implement GetRouteData and GetVirtualPath yourself. In general, I wouldn't recommend that approach except in the most extreme scenarios. Most of the time, you'll want to inherit from Route and add some extra scenario-specific behavior.

Having said that, let's look at an example where we might implement RouteBase directly instead of inheriting from Route. In this section, we'll look at implementing a RestRoute class. This single route will match a set of conventional URLs that corresponds to a "Resource", in our case, a Controller.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial