Sitefinity 3.6 beta - sample bare bones module on the new backend architecture

Sitefinity 3.6 beta - sample bare bones module on the new backend architecture

Posted on January 25, 2009 0 Comments

The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.

Since we have not released the official version, I did not have time to prepare a full blown example of the module prepared on the new backend architecture; however I’ve prepared a brief sample that demonstrates how to work with the new architecture.

This sample demonstrates a pluggable module with embedded templates, using custom command panel and basic control panel. As we finalize the documentation, you will see that you have a plethora of options to rapidly build your modules, alas, we did not have time to prepare all the info on that – so I’ll start with one of the combinations. Do not get afraid that we have created a monster API that will take you months to learn, because you are only required to learn a handful of concepts and all other are optional. An example of this approach is creation of views: you can add views as custom controls with external templates, custom controls with embedded templates or user controls. Another example are command panels: you can let Sitefinity automatically generate commands for you, you can create a custom control for command panel (as I have in this sample), or you can again pass user control to act as command panel.

The basic overview of creating a module

  • Create a module class – nothing has changed here
  • Create a control panel class which acts as your root view (actually, starting with Sitefinity 3.6 it is possible to have multiple control panels, but more on this later)
  • Create one or more command panels in the way you prefer most
  • Add child views to control panel
  • Add child views to child views
  • Add child view to child views’ child views
  • Ok… I wanted to make this clear, the base class for control panel, command panel, and all views is ViewModeControl. Every view mode control can have child views, thus making hierarchy – so you can organize your module in any way you see fit best.
  • Embed templates as resources (or point to external ones... it's up to you)
  • On each of the controls you have created override two properties: LayoutTemplatePath and    LayoutTemplateName
  • Override InitializeControls method on any control where you need to add your business logic
This new approach brings several important benefits:

  • Views are interchangeable – you can use a view from one module in another module
  • Views ensure separation of concerns and declutter the code (no enums and endless switch commands)
  • Views can be plugged in the modules through configuration without overriding the whole module
  • Views can be removed from the module without overriding the whole module
  • Views can replaced with another implementations of views without overriding the whole module
You can download the sample module from here. As I have already mentioned, it demonstrates the rudimentary concepts of creating the modules on the new backend. There will be few improvements in 3.6 official release that will make this process even simpler, which I have mentioned in the code comments.

Let me know if you have any questions.

p.s. do not forget to register module in web.config before trying to use it (we’ll get rid of this pretty soon too :))
progress-logo

The Progress Team

View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.

Comments

Comments are disabled in preview mode.
Topics

Sitefinity Training and Certification Now Available.

Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.

Learn More
Latest Stories
in Your Inbox

Subscribe to get all the news, info and tutorials you need to build better business apps and sites

Loading animation