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.
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
- Copy the CustomDataProvider project from your Kentico installation directory (typically C:\Program Files\Kentico\<version>\CodeSamples\CustomDataProvider) to a development folder.
- Open your web project in Visual Studio (using the WebSite.sln/WebApp.sln file).
- Click File -> Add -> Existing Project and select CustomDataProvider.csproj in the folder where you copied the CustomDataProvider project.
- Unfold the References section of the CustomDataProvider project and delete all invalid references.
- Right-click the CustomDataProvider project and select Add Reference.
- Open the Browse tab of the Reference manager dialog, click Browse and navigate to the Lib folder of your Kentico web project.
- Add references to the following libraries:
- Right‑click the main Kentico website object (or the CMSApp project if your installation is a web application) and select Add Reference.
- Open the Solution -> Projects tab and add a reference to the CustomDataProvider project.
- 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
- Edit your application's web.config file.
Add the following key to the configuration/appSettings section:
<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.
Was this page helpful?