-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General questions - not an issue but seeking more info #9
Comments
Hi @seanyeomans, yep, it reloads the route. You can see that here: https://github.com/Haacked/RouteMagic/blob/master/src/RouteMagic/RouteRegistrationExtensions.cs#L27 The reason is that when you change the file, we don't diff the changes. We just take the easy way out and reload. In theory, we could be smarter about this and not reload them, but just apply the changes. If that's something you'd want to take a crack at, I can help you with the pull request. 😄 |
Turns out we were able to circumvent this happening by running a call to our own routes inside the RegisterRoutes extension, instead of loading them from Global.asax, The idea is to incorporate routes from a DB table, allowing the users to add new ones through a cms. fun stuff. public void RegisterRoutes(RouteCollection routes)
{
MvcApplication.RegisterRoutes(routes); // fire up tertiary routes
//loop through DB retrieved routes
.......
routes.Add("", new LegacyRoute("mooo", "LegacyExternal",
new { externalUrl = "http://www.facebook.com/pages/<snip>" }));
......
//endloop
} edit: |
Cool! And that sticks around if you then edit the routes in p.s. The reason the formatting was off was you didn't indent the first line four spaces. I edited it to fix it by using the triple tick mark syntax instead. It's a better way to add code blocks to a comment. :) |
yessir, it sticks. In theory Config/Routes.cs will never be edited again, but rather the routes are populated on the fly from a db IService call. |
Does the EditableRoutes process presume to replace the Routes table. or does it augment? Do you run it before or after the main Routes are defined elsewhere?
I technically have the pkg 'working', in that it is executing (from Global.asax.cs) and updating the Routes based on ./Config/Routes.cs, but it's wiping out the Routes that have collected up to this point.
It seems that the Collection data is not being passed into the Routes.RegisterRoutes() method when the file is processed. What might I be missing, do you think?
The text was updated successfully, but these errors were encountered: