[This post is part of the developer's manual preview published on this blog. You can find temporary TOC here.]
Most of the time, you as a developer, will be developing end user modules that have a very specific purpose. On the sample modules provided in the documentation we have demonstrated various approaches for this kind of development.
However, from time to time, you will see that you keep developing very similar modules that vary only in details. The example of such module is Sitefinity Generic Content module. When you recognize such pattern, it makes sense to abstract all the commonalities and design one extensible module that could be easily reused across many similar modules.
In this topic of the manual, we are going to explore the subject of designing extensible modules. As a reference we are going to use built-in Generic Content module.
The View independence
In this topic we will not concentrate that much on the data persistence or the API of our module, but rather on the Views as single units of functionality. It is our goal to design a module which consists of Views which can:
You will see that all this becomes much more straightforward if we design Views that do only one single thing (e.g. edit content).
- Have any other View as their Host
- Be located anywhere in the Views hierarchy
- Can have different set of child controls, depending on the module in which they are implemented
By designing Views in such manner we will be able to take any given View from our extensible View and use it in other module with little or no effort. Since we never know in advance where the little modifications might come, we will design every View very flexibly so that the inheriting module can change pretty much any aspect of the base View, while reusing everything else.
Articles in this topic are of a more advanced nature and if you do not have plans for the design of such modules, you may feel free to skip them. The audience that may find this topic very helpful are 3rd party developers for Sitefinity as well as solution providers which work on a large number of projects.