Database table API

Kentico stores most data in database tables. The API uses two basic classes to manage the data of each table – an Info class and a Provider class.

Info and Provider classes for the CMS_User database table

Info and Provider classes for the CMS_User database table

Info classes

Every Info class is related to a specific database table. Instances of Info classes represent entries (rows) in the given table – the class serves as a container for the data of the entry. The properties of an info class correspond to the columns of the related table.

Provider classes

The system uses Provider classes to manage the data of database tables. Every provider is dedicated to a specific table. 

  • Providers usually uses the related Info object to manipulate the data.
  • A typical provider class contains methods used for getting, inserting, updating and deleting table data, together with other required methods.
Code example



using CMS.Membership;

...

// Gets a UserInfo object representing the user with the "Andy" username
UserInfo user = UserInfoProvider.GetUserInfo("Andy");

// Saves the user's email address to a local variable
string userEmail = user.Email;