---
title: Database table API
related:
  - https://docs.kentico.com/13/custom-development/retrieving-database-data-using-objectquery-api.md
  - https://docs.kentico.com/13/custom-development/customizing-the-system-s-data-classes-info-objects.md
  - https://docs.kentico.com/13/custom-development/customizing-providers.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Xperience stores most data in database tables. The public API provides classes for managing the data of each table – an **Info** class, **IInfoProvider** interface (service), and an **InfoProvider** class.

![API classes for the CMS\_User database table](https://docs.kentico.com/docsassets/13/database-table-api/DB_InfoProvider_API.png "API 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.

## IInfoProvider services

Most _Info_ classes have a matching _IInfoProvider_ interface (service), which allows basic management of the given objects – getting, creating, updating and deleting.

_IInfoProvider_ services can be added to your code using _**dependency injection**_ or accessed through the **Provider** property of the corresponding _Info_ class.

```csharp title="Code example"

using CMS.Membership;

...

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

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

```

## InfoProvider classes

_InfoProvider_ classes are the actual implementations of the _IInfoProvider_ interfaces. Every provider manages the data of a specific table using the related _Info_ objects.

We do not recommend using _InfoProvider_ classes directly for basic operations, such as getting, creating or deleting objects. Use the corresponding _IInfoProvider_ service instead.

However, _InfoProviders_ often contain additional business API methods that allow you to perform other operations related to the given object type.

```csharp title="Code example"

using CMS.Membership;
using CMS.SiteProvider;

...

// Gets a user and role
UserInfo user = UserInfo.Provider.Get("Andy");
RoleInfo role = RoleInfo.Provider.Get("ContentEditor", SiteContext.CurrentSiteID);

// Assigns the user to the role
UserInfoProvider.AddUserToRole(user.UserID, role.RoleID);

```
