Using a Custom Data Adapter
Our sample projects and report templates can help you learn the basics of working with our products.Stimulsoft supports many databases out of the box, but you can plug in your own data adapter for a source that is not built in.
Registering the adapter. Add your custom database and adapter service to the global
Using the custom database in a report. Create the database with a connection string, add it to the report dictionary, and open the designer:
The custom adapter is made of a few classes (a database, a source, and an adapter service) that describe how to connect and read data, giving you full control over an otherwise unsupported data source.
Registering the adapter. Add your custom database and adapter service to the global
StiOptions.Services collections so the engine and designer recognize the new data source:StiOptions.Services.Databases.Clear();
StiOptions.Services.Databases.Add(new CustomPostgreSQLDatabase());
StiOptions.Services.DataAdapters.Add(new CustomPostgreSQLAdapterService());Using the custom database in a report. Create the database with a connection string, add it to the report dictionary, and open the designer:
var database = new CustomPostgreSQLDatabase("CustomData1",
"Server=127.0.0.1; Port=5432; Database=myDataBase; User Id=myUsername; Password=myPassword;");
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(database);
report.Design();The custom adapter is made of a few classes (a database, a source, and an adapter service) that describe how to connect and read data, giving you full control over an otherwise unsupported data source.