convert MVC3 Razor to Orchard

Topics: Administration, General
Jan 22, 2012 at 7:27 PM

I'm looking for a way to convert some MVC3 sites to Orchard. I found a short description by 'pszmyd' (stackoverflow) on the subject but do not succeed! Also it seems it's based on Orchard1.1.

I tried with OrchardSRC 1.3.10 and Vs2010 express.

Is there any documentation on this subject?

thanks for your time,ed

Jan 23, 2012 at 5:03 AM

I could be wrong (haven't officially done it), but I think there are only a few necessities:
1)Create a Module.txt with the proper information.
2)Create a Migrations.cs file with at least a Create() method that returns 1 //unless you need the module to configure some database structure.
3)Give up the routes in your global.asax file and configure similar ones in a new Routes.cs file
For these you can use one of the built-in modules like Orchard.Comments as reference for your Module.txt, Migrations.cs and routes.

I think, unless your routes conflict with existing Orchard routes that this will make it possible to get your MVC site (area) into Orchard as a module.

Of course, once that's done you'll likely want to do other things like adding some of your pages to menus and making your module actually work within orchard as opposed to being more like a subsite.


Jan 23, 2012 at 6:56 AM

Hi Will, thanks for your time

I'm just learning Orchard and get along quite well with the standard components / features. One question though to my inital question:

Do I need to apply my MVC3 site /pages using the "OrchardSRC in VS2010" ? OR

can I do this as well via the TestMatrix "Orchard CMS"?

thanks ed

Jan 23, 2012 at 8:28 AM

Let me just clarify websitewill's information. If you try to convert an existing csproj into an Orchard module, there are a number of things you need to reconfigure / add.

It's much easier to create a new, empty module using Code Generation and then copy all the files in from your old csproj. This way, you can be sure that everything is correct, and won't run into any unusual behaviour further down the line :)

See this documentation for how to create a simple module:

Otherwise, Orchard modules are just an "MVC3 area" behind the scenes so most things will work without any modification, but you will probably want to start integrating properly with Orchard's extension poits e.g. creating an INavigationProvider to add admin menu items, an IRouteProvider to customise routing, and so on. However the complete list of things you can do is beyond the scope of a single post, so tell us what specific problems you're having and someone can help you in more detail (or point you to more documentation...)

Jan 23, 2012 at 3:42 PM

thanks again, I succeded to convert my first MVC3 page ... so I guess I understand the process in general, thanks.
...  will digest all this, convert some other pages ..... and come back when needed