asp.net mvc - MVC controller vs. out-of-box Sitecore Controller -
i've been reading lots of blogs on mvc provided here: http://www.sitecore.net/community/technical-blogs/john-west-sitecore-blog.aspx
however, not beingness able explain/convience myself/team:
when utilize custom command vs. out of box site core controller? when out of box controller gets invoked? benifit of custom command vs. out of box controllers? if go out of box, should include business logic on views. testable?i looked @ below , still not certain: https://bitbucket.org/demoniusrex/launch-sitecore-mvc-demo
any help appreciated.
whilst broadly agree kevin obee's statement think it's worth reminding ourselves controllers beingness used in 2 distinct roles in sitecore:
page level controller (invoked item route) component level controller (invoked redering mechanism)when use: custom controller / default sitecore controller
page level controller
any route matches item path default utilize index
action on sitecore.mvc.controllers.sitecorecontroller
. action homecoming viewresult based on layout configuration of item.
if have need changing behaviour (e.g. impacts entire page) can specify custom controller , action on item (or standard values item). custom controller can either roll own or subclass default controller.
component level controller
for viewrendering
sitecore renders razor views without need specific controller (well guess it's page level controller in play - imagine sitecore provides default controller gets model using mvc.getmodel pipeline , feeds razor view).
for controllerrendering
provide custom controller can execute logic (see kevin's answer) , provide model view. there no benefit subclassing sitecore.mvc.controllers.sitecorecontroller
.
when controllers invoked
page level controller
the action on page level controller invoked routing engine.
component level controller
the action on controllerrendering invoked page view renders.
benefit of using: custom controller / default sitecore controller
the benefit of custom controller on default sitecore controller in command of logic. benefit of using default sitecore controller sitecore provides logic you.
should include business logic on views
no. (see kevin's answer)
asp.net-mvc sitecore sitecore6
No comments:
Post a Comment