Skip to content

Library which adds strong typing to the URL-routing/generation in Microsoft's MVC4/5 (v2: *pretty* usable now)

License

Notifications You must be signed in to change notification settings

bunsen32/typed-url-routing

Repository files navigation

typed-url-routing

This is a library which adds strong static typing to the URL-routing and link generation in Microsoft's MVC4 (and MVC5).

It lets you:

  • Define your application’s URL routes as statically-typed, first-class-objects
  • Bind routes to controller actions, in such a way that the compiler catches your mistakes (like parameter mismatches or misspellings)
  • Generate links in your Razor code (a) succinctly and (b) checked at compile-time.
  • Use Visual Studio refactoring to rename routes or actions, automatically—without missing any references.

The key things you need to know are:

  • It all works at compile time. You don’t need to run a program to generate code or anything like that. Just include the assembly in your project and start using it.
  • You will write less code.

I’ve used it so far in a 3 commercial web projects:

  1. A small intranet system for an energy supplier;
  2. In the business-to-business website and associated back-office systems for a logistics company;
  3. Intranet system for an international electronics recycling company.

It’s reached a level of maturity where it’s much more comfortable to use than the built-in, dynamically-typed, MVC routing system.

It now has a website, including an introductory tutorial:

http://url-routing.dysphoria.net

Here’s the original blog post which explains the project:

https://dysphoria.net/2013/03/14/strongly-typed-action-references-in-microsoft-mvc4/

I can’t offer commercial support at the moment, but please get in touch if you’re using it. Do let me know of any problems you have with it, or suggestions. Also, pull requests for improvements are very welcome!

–Andrew Forrest

About

Library which adds strong typing to the URL-routing/generation in Microsoft's MVC4/5 (v2: *pretty* usable now)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages