Modules

This article explains the Modules API concepts.

What is a Sitefinity module?

A module represents backend component, from which an user can create, delete or modify certain type of content items (content types). These content items can have different data fields, or implement comments for example.

The built-in modules provide user interface for these tasks, as well as API.

Built-in modules and their Manager Class

Every built-in Sitefinity module has a manager class. The naming convention of these classes is very consistent. For example, the Blogs module has a BlogsManager class, the Events module has EventsManager class, the News module has NewsManager class, and so on.

These classes are a point of access for any data-related work, though they don’t work directly with data. Any manager class can be instantiated with a provider name.

Note

If an empty constructor is used, Manager classes will be instantiated with the default provider.

Once instantiated, the manager class will use the appropriate provider to perform actual data manipulation. For example, the BlogsManager class exposes the public method DeleteBlog(Guid id). You can call that method and pass it the id of the blog to be deleted from anywhere inside of your application. The manager class will then call DeleteBlog(Guid id) method on the actual provider which will delete the specified blog from the data storage. The reason for this middle layer is quite simple. Let’s assume you have developed several controls that use the BlogsManager class and its members. Now that all the work is done, you decide to store data in XML files instead of SQL Server. All you have to do is implement XML provider for the Blogs module. Your controls will still call the BlogManager class and its members, but they will instantiate the BlogManager class with the name of your XML provider. So, without any modifications on the controls you have developed you are able to change the data storage for Blogs Module. This is the main reason why we don’t encourage developers to program directly against database.

When talking about built-in Sitefinity modules, it is important to note that manager classes expose publicly all methods and functions needed for the modules to work. The modules you are using everyday are built exclusively using the manager classes, and you have access to these classes as well. All the CRUD methods are fully accessible through the module API.

Note

You may also check the Fluent API for modules. Documentation on this is available here.

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK