Controller reuse in asp.net mvc
I have a two different projects that are actually two different websites
when deployed, say WebA & WebB. The structure of both websites is the same
in terms of the controllers and models they use. However, the front end is
very different. They each have their own UI and own jquery plugins that
work for them.
To reduce code duplication, I am proposing both those projects inherit
from controllers in another referenced project[controllerDLL].
ControllerDLL is a project that will have all the logic for calling the
business layer and returning json serialized model objects. WebA & WebB
will each just have empty controller classes that just inherit from the
base project[controllerDLL]. This way I feel the controller code is not
duplicated.
Can anyone tell me a better way to achieve controller reuse other than the
way I have proposed? Does asp.net mvc 4 provide any built-in way to do
this better? Can I use AREAS here productively? Or is my approach the best
way forward?
Thanks.
No comments:
Post a Comment