Trying to add a MVC area

Topics: Troubleshooting, Writing modules
Jan 23, 2014 at 4:38 PM
I have written and deployed small MVC app in VS 2013 with MVC 5. I find myself needing more functionality. static pages blog etc. I have been trying for 3 weeks to incorporate my apps functionality into Orchard.

I have tried creating a new module thru codegen but when I use this method I lose the a lot of the basic MVC capability(eg. @model and @Html.DisplayFor) that I need in my views in spite of adding every reference that is in my original project.

I have tried adding MVC projects thru Visual Studio ( both MVC 4 and 5) projects) but I always wind up with what appear to be routing problems, both with and without a routes file. I suspect that AutoRoute does not apply to projects not generated from codegen.

The Orchard "way" of doing things is well beyond my ability to implement in the near term.

Is there always a trade off between using codegen to create modules and using VS to add new module projects or am I missing something. I have exhausted every resource I can find on the internet and welcome any comments or advice. I really like Orchard but I'm ready to give up and run two separate websites.

Thank in advance
Developer
Jan 24, 2014 at 6:52 PM
@model and DisplayFor() should work. What do you mean you "lose the a lot of the basic MVC capability" specifically?

Orchard modules are MVC areas with a Module.txt. There are a few gotchas here: basically you can't do anything that you'd do through Gobal.asax (without modifying it but you don't want to do that) but for almost every possible MVC extension point Orchard exposes a corresponding "Orchard-y" extensions point.
Jan 24, 2014 at 7:08 PM
I would have expected that they would work, however when I add a view, @model is not recognized as being passed in from he controller and I only get an abbreviated list (19 vs. 72 in my original project) of html helpers. I have had some other issues with data annotations etc. (again a only portion the what's in the namespace) not being recognized despite having added the appropriate references. I'm trying to push through and find work abounds as I really like Orchard, but it is very frustrating given my limited knowledge. On the hand I have learned an enormous amount in the last few months.

Anyway Thanks.
Developer
Jan 24, 2014 at 9:50 PM
This is quite strange. My last guess would be that there is some issue with your module's Web.configs. What happens if you change the module's root Web.config and the on in Views to one from any built-in Orchard module?
Jan 25, 2014 at 3:50 PM
Well that didn't work either. The module I was working in was created by codegen but I tried the switch anyway. Then I tried creating a new module thru Visual Studio and doing the swap in that project but that did not work either. Could it be VS 2013? Is worthwhile to dig out a copy of VS 2102?
Developer
Jan 25, 2014 at 7:35 PM
I think VS 2013 shouldn't have any issues, especially with Orchard 1.7.x (VS 2012 can't handle the 1.x branch OOTB without installing the latest Web Tools).