AI agents: the content index is at /llms.txt. Every page is also available as Markdown — send the request header Accept: text/markdown, or append .md to the page URL.
Xperience Docs

Cookie consent

We use necessary cookies (opens in a new tab) to run our website and improve your experience while browsing. Additional cookies are only used with your consent. You may revoke your consent on the Cookies Policy (opens in a new tab) page or in your browser at any time.

Configure (opens in a new tab)
  • Documentation
    InstallationUsing the Xperience interfaceDeveloping websitesConfiguring XperienceManaging usersSecuring websitesDeploying websitesManaging website contentMultilingual websitesMacro expressionsExternal utilitiesIntegrating 3rd party systemsCustom developmentE-commerce featuresOn-line marketing featuresRelease notes - Xperience 13Xperience terminology glossary
  • Tutorial
    Using the Xperience interfaceDeveloper tutorialBusiness tutorialResource hub for marketers
  • API Examples
    ConfigurationContent managementDevelopmentE-commerceOn-line marketingSocial media
  1. Home
  2. Custom development
  3. Database table API

Database table API


Was this page helpful?

Send us feedback Go back to top

Related pages

  • Retrieving database data using ObjectQuery API
  • Customizing the system's data classes (Info objects)
  • Customizing providers
  • Community Questions & Answers (opens in a new tab)
  • Contact support (opens in a new tab)

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.

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.

C#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.

C#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);