asp.net mvc - Subsequent Methods Dependent on 'primary method' result -
this structure question of code bit unsure of how proceed bearing in mind performance.
in application have method has run on every request goes db , gets values based on url, before else can happen (think cms re need know site being looked at).
i have done in 'basecontroller' on initialize
other controllers inheriting , seemed work fine. i.e. put result in public variable , able access in actionresult
or whatever neeeded. key was called once per page request.
now kind of fundamentally changing structure more 'widget' style. every widget need data, , there anywhere 1 ... alot of widgets on page.
when each widget's model don't want hit db every time same info before getting 'actual' data widget.
so should 'data' once pre loop , feed method calls each widget .... or case type of dependency injection can help? (i bit 'green' in area :p )
it's don't want write each widgets method e.g.
public list<string> widgetaresult (object thecoreobj, ... other stuff ...){}
and don't want each widgets 'sql' script have same code @ begining because if changes in 'core' call need update of them...
any thoughts appreciated
cheers
robin
Comments
Post a Comment