Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC 3 Custom routing from sql
    primarykey
    data
    text
    <p>I'm working on a CMS/Webshop engine with a MVC 3 front-end. I want to be able to define url "aliases" for dynamic content/products runtime, and I want to be able to route this URLs to MVC controller actions.<br> For example I want to be able to define </p> <blockquote> <p>~/Products/Motherboards/{manufacturer}/{uniqueName}<br> ~/HugeSavings/{uniqueName}<br> ~/Products/{uniqueName} etc.</p> </blockquote> <p>to map to the same Display(string uniqueName) controller action in ProductsController. These url patterns are dynamic, even the rules for their order or composition is <strong>NOT DEFINED</strong> at design time, the pattern's rule or pattern's content can change in runtime without restarting the application, they are stored in SQL, but needs to be cached. Each pattern has a target which may be a typical MVC url like </p> <blockquote> <p>Products/Display/{uniqueName}</p> </blockquote> <p>or a direct link like</p> <blockquote> <p>`http://somestuff.com/stuff.aspx?name={uniqueName}.</p> </blockquote> <hr> <p>Every solution I've found used </p> <pre><code>RegisteredRoutes.Clear(); RebuildRoutes(); </code></pre> <p>which is horrible, because of this for adding one new pattern for one product (or product category) I have to query the database for thousands of products and their corresponding patterns.</p> <p>So, can I change routes without clearing or restarting the app? Can I "inject" some logic to routing WITHOUT having to recode the whole "look up the controller and action and parse the parameters" thing.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload