Extend Sitefinity CMS data model: Create the custom type class

After you reference the required assemblies, you implement the custom type class. The custom type class is used to persist the information to the database. Such classes are also called model classes. Depending on the design, you can create more than one model class.

To be more consistent with Sitefinity's architecture, the CustomType class implements the IDataItem interface. Inside the CustomTypesclass you add the properties that are persisted to the database.

  1. In Visual Studio, open the context menu of the project and click Add » Class.
  2. Name the class file CustomType.cs
  3. Make the CustomType class implement the IDataItem interface.
  4. Define the ApplicationName, Id, LastModified, Provider, and Transaction properties from the IDataItem interface.
  5. Define any additional properties that you want to persist to to database.
  6. Create a constructor that sets the values for the ApplicationName and Id.

Use the following code sample:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

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.

Web Security for Sitefinity Administrators

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.

Foundations of Sitefinity ASP.NET Core Development

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.

Was this article helpful?