Driver vs Controller?

Topics: General, Writing modules
Dec 29, 2014 at 3:55 PM
Hi all,

I try to learn Orchard and orchard module development by looking at the code of the existing modules and reading documentations. I know the idea behind Driver and Controller, but I do not understand why in some modules like Blog or Nwazet.Commerce both of them are used.

I see that when Controller is used, the shape property is added to the controller. So I'm confused why there is a mix of these two. I would appreciate it if someone could tell me why experienced orchard developers use controller and driver in the same module?
I'm sure there is a good reason for that, but when should I use controller with shape property and when use Driver?

Thanks in advance,
Alex
Developer
Dec 29, 2014 at 7:52 PM
Edited Dec 29, 2014 at 7:53 PM
Controllers are used to process HTTP requests, while drivers are used to create a list of shapes. They are 'controllers' specific to content parts, whereas MVC controllers are controllers specific to HTTP requests.

Perhaps this post helps: http://www.ideliverable.com/blog/a-closer-look-at-content-types-drivers-shapes-and-placement - it has a section called Content Part and Field Drivers that explains drivers in more detail.