how to call my orchard module with alias?

Topics: General, Writing modules
Feb 22, 2013 at 5:42 AM
Edited Feb 22, 2013 at 5:44 AM
Hi,

I'm quite new to Orchard module development. As most of the newbies would say in this forum...

One thing I've noticed from varies of tutorials existing on the web is when developing my own module, the naming convention for module name is something like
CompanyName.ModuleName

the problem is that if I name my module like this, when calling a particular action from browser, the url would looks like
example.com/CompanyName.ModuleName/Controller/Action
for admin controller
example.com/Admin/CompanyName.ModuleName/Action

I would like to know if there is a convenient way to make an alias with the MVC area name to make the route prettier
example.com/ModuleName/Controller/Action
and for admin controller
example.com/Admin/ModuleName/Action
since my module probably would only be used by my own.

I've learned that there are a couple of ways for achieving this, for example:
  1. name the module without the prefixed "CompanyName", which I think is not a good idea to solve this problem;
  2. Add Routes.cs into my own module;
  3. Enable Orchard.Alias UI and manually config a route from Admin Panel;
But my question is - is there a better way to achieve this goal in one time so that next time when I develop new modules with a particular "CompanyName" namespace, Orchard will automatically skip the prefix and only looking for "ModuleName"? Does Orchard.Alias support regular expression?

Many Thanks
Coordinator
Feb 22, 2013 at 6:40 AM
Go for 2. Not sure what would be a better way.