Views

Mar 4, 2010 at 1:57 AM

Yes, it’s me again. Sorry.

Do you have any examples of how to override a view and how to provide a view that does not exist in the core site?

All of the views are in your primary project under site. I don’t see any in the secondary modules only controllers and models.

Am I missing something?

Thanks,

Rick

Coordinator
Mar 4, 2010 at 8:55 AM

:)

What you see in site is something like this:

/core/views

/module1/views

/module2/views

/module3/views

 

Each of those module directories contains a manifest which tells MvcEx where to get the controller actions from for those views.

Effectively this means that in order to add a module to the application you have to add a  views folder for it under the /site/ structure, and a binary containing the actions.

While it would be more separated to have the binaries provide the views in a neat little package, it doesn't provide a good development experience, and because our multi-tenant software is entirely internally developed it doesn't matter what the main application always has all of the modules nested inside of it, as what really matters is whether they're turned on or not in a configuration.

I hope that makes sense?

 

Mar 4, 2010 at 1:05 PM

It does make sense except from a code organization point of view. Couldn't you add the path to the new view to the search locations of the view engine? If it finds one in the external project, load it, otherwise use the one in the root project?

Also, I ran the 2008 version, set the config to "customertwo" and was expecting the Extra() method in site.premium.Controllers.Home to be called. For some reason it is not working.

Is there something else I need to do besides set the config to "customertwo" in global.asax.cs? If not, then the project on the site may have a bug.

Thank you for your time.

Rick

Coordinator
Mar 4, 2010 at 1:52 PM

Sure could do that, it has only been done the way it has been done because it made sense in the product this was made for in our company :)

Anyway - I've just ran the project from the source and that should be all you have to do - have you made sure to rebuild etc? Changes to global.asax don't always restart the server as you'd expect.

Mar 4, 2010 at 6:10 PM

Here are the steps I tried:

-          Download new source from codeplex

-          Open in VS2008

-          Change the config in global.asax.cs to “customertwo”

-          Set a breakpoint at site.premium.Controllers.Extra()

-          Rebuild all

-          Run with F5

The result is that the breakpoint is not hit and the “This is the Premium Extra action” string is not displayed.

Did I miss a step?

Rick