This project is read-only.

Custom Development Options with Orchard

Topics: Core, General, Writing modules
Dec 24, 2013 at 11:58 AM
I noticed there are two ways to do custom module development in Orchard:
  • Content Parts / Widgets
  • Normal ASP.NET MVC Controllers/Views
What's the recommended way of developing modules? The latter option causes links to have module name attached to URL.

Appreciate your support.

Dec 24, 2013 at 1:51 PM
Edited Dec 24, 2013 at 1:52 PM
I don't think you can compare those two things, as one is not a replacement for the other. Also, you will implement content parts, widgets, controllers and views as you need them. Sometimes you just need a content part, sometimes just a controller, sometimes just a filter, a handler, and probably most of the times all that and more.
So I guess the recommended way of developing modules is to pick what you need to meet a requirement.
Dec 24, 2013 at 10:56 PM
Great! Is there a guideline regarding Orchard module development? When to use which?

Dec 25, 2013 at 8:59 AM
If you're unfamiliar with MVC, reading up on that is recommended. Orchard's documentation takes you through developing content parts.
Perhaps the web shop tutorial helps:
It uses parts, drivers, controllers and more to build a web shop module.
Dec 25, 2013 at 9:52 AM
Hi Sipke,
I am experienced in ASP.NET MVC. My inquiry is more related to recommendations or guidelines regarding Orchard as a CMS. For example, for X scenario, a Content Type/Content Part is needed, for scenario Y, Controller only is needed, etc.

I will have a look at your blog series, already have it bookmarked here :-)

Dec 27, 2013 at 10:42 AM
Hi Sipke,

While still at Part -4 of your series, I added the Driver and tried to create a new "Book". I got the following exception.

Please note that I have the "Simple Commerce" module developed by Bertrand Le Roy installed in the same instance of Orchard. Why would I get such a mix-up in models, where each model class is in its own module?

Thank you
 The model item passed into the dictionary is of type 'Orchard.Webshop.Models.ProductPart', but this dictionary requires a model item of type 'SimpleCommerce.Models.ProductPart'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The model item passed into the dictionary is of type 'Orchard.Webshop.Models.ProductPart', but this dictionary requires a model item of type 'SimpleCommerce.Models.ProductPart'.

Source Error:

Line 757:            var adjustedViewContext = new ViewContext(Html.ViewContext, Html.ViewContext.View, adjustedViewData, Html.ViewContext.TempData, Output);
Line 758:            var adjustedHtml = new HtmlHelper(adjustedViewContext, new ViewDataContainer(adjustedViewData));
Line 759:            adjustedHtml.RenderPartial(TemplateName);
Line 760:        }
Line 761: