---
title: Custom Data provider example
---

> 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).

Customization of the data provider allows you to implement your own database connector.

You cannot modify the data provider in the App\_Code folder. The customizations must be added as part of a new assembly, which you then need to register via the **CMSDataProviderAssembly** web.config key.

> **Note:** Custom data providers are **not** intended for accessing non-Microsoft SQL Server database engines. They only allow you to modify how queries are executed against the Microsoft SQL Server.

## Adding the custom data provider assembly

1. Copy the **CustomDataProvider** project from your Kentico installation directory (typically _**C:\Program Files\Kentico\\\<version>\CodeSamples\CustomDataProvider**_) to a development folder.
2. Open your web project in Visual Studio (using the **WebSite.sln/WebApp.sln** file).
3. Click **File -> Add -> Existing Project** and select _**CustomDataProvider.csproj**_ in the folder where you copied the CustomDataProvider project.
4. Unfold the **References** section of the **CustomDataProvider** project and delete all invalid references.
5. Right-click the **CustomDataProvider** project and select **Add Reference**.
6. Open the **Browse** tab of the **Reference manager** dialog, click **Browse** and navigate to the _**Lib**_ folder of your Kentico web project.
7. Add references to the following libraries:

   - CMS.Base.dll
   - CMS.DataEngine.dll
   - CMS.Helpers.dll
8. Right‑click the main Kentico website object (or the CMSApp project if your installation is a web application) and select **Add Reference**.
9. Open the **Solution -> Projects** tab and add a reference to the **CustomDataProvider** project.
10. **Rebuild** the CustomDataProvider project.

The CustomDataProvider project is now integrated into your application. By default, the classes in the custom data provider are identical to the ones used by default, but you can modify them according to your own requirements.

## Registering the custom data provider

1. Edit your application's web.config file.
2. Add the following key to the configuration/appSettings section:

   ```html

   <add key="CMSDataProviderAssembly" value="CMS.CustomDataProvider"/>

   ```

The system loads the **DataProvider** class from the namespace specified as the value of the **CMSDataProviderAssembly** key.

Your application now uses the custom data provider for handling database operations.
