Oracle Provider

Xafari.DB Module Overview

The Xafari.DB module is intended to operate databases and is currently compatible with Oracle DBMS.

The Xafari.DB module solves the following tasks:

  • Saving object names that are longer than average (30+ symbols) on the Oracle platform when the version of DevExpress is being updated.
  • Improvements to Xafari application performance on the Oracle platform.

Saving longer object names on the Oracle platform when updating the DevExpress version

In the Xafari.DB module, two classes are implemented:

  • XafariODPConnectionProvider,
  • XafariOracleConnectionProvider.

These classes are the descendants of the following DevExpress classes:

  • ODPConnectionProvider,
  • OracleConnectionProvider.

Each of the mentioned classes has an overriden implementation of the ProcessUpdateSchema() method.

The ProcessUpdateSchema() method is called when the DB of the app updates. This method contains the code that creates 4 tables to store long (exceeding 30 symbols in length) names of Oracle objects. Each table has a special purpose:

  • OracleTableDifferences – this table stores the differences found in the names of tables,
  • OracleColumnDifferences – this table stores the differences found in the names of table columns,
  • OracleIndexDifferences – this table stores the differences found in the names of indexes,
  • OracleConstraintDifferences –  this table stores the differences found in the names of constraints for tables.

During the process of executing the ProcessUpdateSchema() method, the tables are filled up with data based on the principle of storing full table names alongside with the same names after shortening to the length of 30 symbols. This reduced name is stored in the DB.

An example of a complete table:

  • example

select * from AMM431750."OracleTableDifferences"


After adding the Xafari.DB module to the project, the tables that store differences are created once and filled up with data during the next DB update call. After that, the data is added into these tables when new persistent objects (and tables being represented by such objects) appear in the application.

Shortened table names can undergo changes when the DevExpress version is updated. To solve this issue, the Xafari.DB module provides the following override methods:

  • ComposeSafeTableName(),
  • ComposeSafeColumnName(),
  • ComposeSafeConstraintName().

These methods return values taken from the tables of differences.

Performance of Xafari applications on Oracle platform

When Xafari applications process large amounts of data on the Oracle platform, the performance is significantly lower in comparison to the same application using MS SQL.

The analysis of the problem showed that the indexes were not used in the process of forming complex requests to the database despite the fact these indexes existed in the database. Further investigation discovered the root cause of the problem.

Most business classes have the Guid type in their "Oid" property fields. Such fields obtain the CHAR type when being mapped into the Oracle DB. Then, complex parametrized requests emerge during the application activities. These requests include conditions that pass some parameters with NVARCHAR2 to the columns that have the CHAR type, making Oracle internally convert the types.

This problem has been solved by overriding the CreateParameter() method to keep the CHAR type for all fields with the Guid type. Two charts below represent the period required to perform a complex request that involves much data without the usage of Xafari.DB and with it.


Img #1: The time of processing a complex request without Xafari.DB


Img #2: The time of processing the same complex request with Xafari.DB being activated

The highlighted area in the charts shows the time required to execute the same function in the application. The processing of the function took 2280 seconds (38 minutes) without using the Xafari.DB module and only 48 seconds with enabled Xafari.DB.

Adding Xafari.DB to Your Project

The Xafari.DB module is already included into the Xafari Framework installation kit and can be added into the application through the configuration file (see the sample below).

  • xml

      <add key="Modules" value="Xafari.DB" />

To be sure that the module can be appended via the configuration file, check if the application has the appropriate code snippet as described in the original DevExpress online documentation.