Skip to main content
A newer version of this page is available. .

Register a Custom Schema Provider for a Synonym Database

  • 2 minutes to read

This document describes how to implement a custom data source schema provider that enables end-users to bind reports to a synonym database.

Tip

A synonym is a database object that provides an alternative name for another database object.

To learn about support for synonyms by different database engines, refer to the Oracle and Microsoft SQL Server documentation.

This document consists of the following sections:

Implement a Custom Schema Provider

The following code shows how to create a custom database schema provider inherited from the DBSchemaProviderEx class that is a default implementation of the IDBSchemaProviderEx interface.

using DevExpress.DataAccess.Sql;
using DevExpress.Xpo.DB;
using System.Collections.Generic;
using System.Linq;
// ...

public class SynonymDBSchemaProvider : DevExpress.DataAccess.Sql.DBSchemaProviderEx {
    public override DBTable[] GetTables(SqlDataConnection connection, params string[] tableList) {
        List<DBTable> tables = base.GetTables(connection, tableList).ToList();
        if(connection.Name == "OracleConnection")
            tables.Add(new DBTable("Regions") {
                Columns = {
                    new DBColumn { Name = "REGION_ID", ColumnType = DBColumnType.Int32 },
                    new DBColumn { Name = "REGION_NAME", ColumnType = DBColumnType.String, Size = 25 },
                }
            });

        return tables.ToArray();
    }
}

Register the Schema Provider in a WinForms Reporting Application

The following code registers a custom database schema provider in an End-User Report Designer by calling the XRDesignMdiController.AddService method.

using DevExpress.DataAccess.Sql;
using DevExpress.XtraReports.UserDesigner;
// ...

public partial class Form1 : XRDesignRibbonForm {
    public Form1() {
        InitializeComponent();
        DesignMdiController.AddService(typeof(IDBSchemaProviderEx), new SynonymDBSchemaProvider());
    }
}