A facade is a design pattern that simplifies the complex details of a system. For example, a facade can make a class library easier to use by providing a simplified interface for it. A facade would usually consist of all the library classes.
Since the Fluent API is another layer of abstraction, or a wrapper of the basic API introduced in Sitefinity CMS, there are different facades that can be used in the context of the Fluent API to make the developers' work easier.
In the following example, the Blog() statement acts as a facade to everything related with the Blog content type. It gives options for creating, deleting, or updating a blog in Sitefinity:
There are other facades that give access to other system parts and content types - facades for news, pages, taxonomies, etc.
Following is a sample list of facades:
Each of this facades provide methods for creating, updating, deleting, and getting items for further processing.
For more information about how to start using the App class, how to choose a provider to work with, and how to select the content type or module you want to work with, see For developers: Entry point and methods.
In some cases, when you work with a given facade, you need to access another one. This is usually the case when you work with parent and child objects, such as a page and a widget, a content item and a comment, a taxonomy and a taxon.
In the following code example there are both page and widget facades. It creates a page with name My Test Page and adds two widget in it. After this, it creates another page and finally it executes all the actions in a single transaction via the SaveChanges() method:
NOTE: The Done() method is returning the parent facade, which is the page facade. This allows you to continue the work with the parent object, after you have finished with the child one. The Done() method is returning the parent facade object, and is called in child facades.
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important