2
votes

I recently walked through the Advanced Orchard tutorial on Pluralsight and it really showed me a lot of things I can do to extend Orchard. That said, I was wondering if there is a way for one module to return a view from another module?

The scenario for this is I'm building custom modules for my clients that have features that would be proprietary so I'd want to protect them with an API key, similar to how oForms works. The only difference from mine to theirs is they allow functionality regardless of activation whereas mine wouldn't work at all so I'd like to have a base module that all of my custom modules derive from and each one could do something like:

if (this.IsActivated())
    return View("ViewFromThisModule")
else
    return View("NotActivatedViewFromBaseModule")

The real purpose behind this would be so I don't have to copy the view(s) utilized in the base module to each custom one for things such as whether the module is activated or not.

1
I don't think you can do that even from regular MVC between areas, and it really doesn't sound like such a great idea.Bertrand Le Roy
Would it be best to just copy the view(s) from the base module then or how would you approach this? I'm fairly new to the MVC world (I've been doing webforms for ~8 years) so I want to make sure whatever pattern I implement is logical so I'm not learning this stuff incorrectly.Scott Salyer
Yes. If the view really usable in both situations, one has to wonder, why are there two modules?Bertrand Le Roy
The eventual goal is my own module library with 20+ so I was just trying to go with as little duplication as possible. Having a base library for all the shared features seemed logical in that goal.Scott Salyer
Why not have features inside of a single module?Bertrand Le Roy

1 Answers

0
votes

Per Betrand's suggestion, instead of going the multiple module route I'll instead do a single module that breaks out features instead. Then I don't need to share anything because the whole thing is self-contained.