+1-888-365-2779
Try Now
More in this section
Categories
Bloggers
Blogs RSS feed

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

by Ivan Osmak
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 :))

6 comments

Leave a comment
  1. Burl Doty Jan 28, 2009
    Hi Ivan,

    Can the modules be packaged in a way to make them reusable in other SiteFinity sites? I'm looking into this as a replacement for DotNetNuke sites in the future.

    Thanks Burl
  2. Kevin Feb 06, 2009
    Burl,
    I can't speak for Ivan, but that's the point of modules that you build for Sitefinity
  3. Larry Feb 13, 2009
    Now that Sitefinity 3.6 has been officially released, is there any documentation about the new module creation/extensibility?  The new functionality cannot be leveraged effectively without it.
  4. Drew Feb 24, 2009
    I know you had a Webinar that talked about the new module development.  Has that been posted anywhere?
  5. Ivan Feb 24, 2009
    Hi Drew,

    honestly I am not sure. It should eventually appear in the webinars section on sitefinity.com (http://www.sitefinity.com/support/webinars.aspx) and probably on Telerik TV (http://tv.telerik.com/home), but as of now it doesn't seem the webinar is there. I'll try to poke around and see what's the hold up, since there have been several people asking for this webinar. In the mean time, the post series on the new architecture is covering everything I've talked about on the webinar and doing so in much more detail.
  6. Lesley-Ann Mar 13, 2009
    Hi there

    I'm a newbie to this and can't figure out what to put in the web.config to make this work.

    I've tried just adding it to the "Modules" section, but I get the an error about it trying to reference an old version of the library.  I've updated the reference in the project to be the newer library file.  Really don't know what's next.  I can't copy the newer examples, because this one doesn't have the same structure (doesn't use the provider pattern).  Any guidance?  Is this example now obsolete??

    Message: Could not load file or assembly 'Telerik.Framework, Version=3.6.1834.2, Culture=neutral, PublicKeyToken=dfeaee0e3978ac79' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    Source: mscorlib

    Stack Trace:

    at System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase)

    at System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)

    at Telerik.Utilities.TypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)

    at Telerik.Utilities.TypeResolutionService.GetType(String name, Boolean throwOnError)

    at Telerik.Utilities.TypeResolutionService.ResolveType(String name, Boolean throwOnError)

    at Telerik.ModuleManager.LoadModules(Boolean reload)

    at Telerik.ModuleManager.LoadModules()

    at Telerik.ModuleManager..cctor()

    Leave a comment