Developer forum

Forum » Development » Cohabit MVC in multiple websites

Cohabit MVC in multiple websites

António Ramos
António Ramos
Reply

Hi guys,

We have an customer with a lot of custom modules and websites inside a old 8.6.0.4 DW version.

Can we use MVC to create a new logic for other websites without compromise the older ones?

Which approach do you think that it's the best?

BR,

António Ramos


Replies

   
António Ramos
António Ramos
Reply

Thanks for your answer.

We already tried but we had some issues with Global.asax (see dump).

Beside i tried with Wrap8 solution and i also had a problem (see https://www.screencast.com/t/f7vHcYG5o). Even if we go to directly to /produkter we have the same issue.

Thanks for helping.

BR,

António Ramos

errorMVC.png
 
António Ramos
António Ramos
Reply

bump

 
Nicolai Pedersen
Reply

That exception is basic - read it, and fix it :-).

Search the forums for global asax issues. And for MVC setups.

 
Gaëtan Di Caro
Reply

I'm afraid you pasted the same link twice. I can't seem to find the documentation dor setting up MVC with DW9.

 
Nicolai Pedersen
 
António Ramos
António Ramos
Reply

Hi,

Thanks for your help. We manage to fix the issues by chaging the default route.

We are having other question, can we share layout templates (e.g. master) between DW and MVC Views?

BR,

António Ramos

 
António Ramos
António Ramos
Reply

Other question:

Can we call MVC views at DW Razor Templates?

 
Nicolai Pedersen
Reply

Hi Antonio

@Sharing masters: Nope, not possible as it is 2 different master concepts. You can however, create helpers and reuse across the 2 by using includes (also note, that include syntax is a bit different)

@Calling MVC views from DW Razor templates: It is simply a class, so just call it. see i.e. here: https://stackoverflow.com/questions/16870413/how-to-call-another-controller-action-from-a-controller-in-mvc

 
António Ramos
António Ramos
Reply

Hi Nicolai,

Thanks for your answer. A couple more questions:

- Can we override the template engine to use MVC instead RazorEngine (DW Version: 8.6.0.4)?

- Do you have any working example of MCV + DW templates?

Best regards,

António Ramos

 
Nicolai Pedersen
Reply

Hi Antonio

No and no.

It is a too big explanation for here. But Dynamicweb has one dynamic view model (PageView) with sub models. MVC does not handle that in a way that makes sense in DW - hence the RazorEngine. RazorEngine uses the internals of MVC, but not all the magic of routing, controls, views etc.

But MVC is just a set of classes and so is DW and if you fully understand how MVC works, it is a 'piece of cake' to design your solution for it.

I do not know what you are trying to create - but it sounds like DW modules would be a better choice.

BR Nicolai

 

You must be logged in to post in the forum