I am writing an area for administering several subsites, almost all functions will be the same on each site (add / edit / delete pages, etc.), and my repository accepts SiteIdentity when creating an instance, therefore all methods of accessing data are agnostic due to by this. The problem that I have at the moment is trying to make my methods of action also agnostic.
The URL pattern I want to use matches the lines:
"ExternalSite/{identity}/{controller}/{action}/{id}"
The naive approach is for each action to take an identification parameter, but this means that you need to transfer it to my repository for each action, and also include it in the ViewData for several user interface elements. I would prefer this to happen in the controller, for example, in its constructor.
What is the best way to do this? For now, the best I can think of is to find and give out an identity from the RouteData dictionary, but part of me seems to be a more elegant solution.
source share