Driver vs. Controller

Topics: Writing modules
Mar 29, 2011 at 5:23 PM

Can someone tell me the difference between a controller and a driver? When to use which one?

Thank you

Coordinator
Mar 29, 2011 at 8:10 PM

A controller acts at the whole request level, whereas a driver acts at the content part level.

I posted a detailed explanation of what happens when you navigate to a page here:

http://weblogs.asp.net/bleroy/archive/2011/03/29/what-happens-when-i-request-a-page-in-orchard.aspx

Mar 30, 2011 at 4:57 PM
Edited Mar 31, 2011 at 2:44 PM

Even though your controller acts at the whole request leve', you can still have the html you return be wrapped with the theme of your website by applying the [Themed] attribute to your controller. For reference, look at the Hello World example:

http://www.orchardproject.net/docs/Building-a-hello-world-module.ashx