Skip to main content

Replacing Data Sources

When embedding the Reveal SDK in your application, you can replace the connection details of data sources at runtime. This allows you to change various properties of the data source such as the table, port, database, schema, host, file location, and more depending on the data source being used.

The Reveal SDK utilizes the data source provider to give you, the developer, an opportunity to modify the details of a data source. It also provides the User Context so that you can use information about the current user, and properties of that user, to load the appropriate data.

A data source provider can be created with two steps:

*Step 1 - Create the data source provider.

public class DataSourceProvider : IRVDataSourceProvider
{
public Task<RVDataSourceItem> ChangeDataSourceItemAsync(IRVUserContext userContext, string dashboardId, RVDataSourceItem dataSourceItem)
{
throw new NotImplementedException();
}

public Task<RVDashboardDataSource> ChangeDataSourceAsync(IRVUserContext userContext, RVDashboardDataSource dataSource)
{
throw new NotImplementedException();
}
}

Step 2 - Register the data source provider with the Reveal SDK.

builder.Services.AddControllers().AddReveal( builder =>
{
builder.AddDataSourceProvider<DataSourceProvider>();
});