The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

How to: Connect XPO to a Database Other than MS SQL or MS Access

XPO supports a number of database engines, all of which are listed in Database Systems Supported by XPO, together with corresponding XPO data store adapters and database provider assemblies. The adapter assembly name contains the server name it supports. For example, DevExpress.Xpo.Advantage supports the Advantage database, DevExpress.Xpo.Ase supports Sybase, and so on.

 

To make XPO use your database server, you should do the following:

  • Add the assemblies that correspond to your server to your project's References.
  • Create a connection string using the GetConnectionString function of the appropriate ConnectionProvider class from the DevExpress.Xpo.DB namespace.
  • Connect XPO to a database.

Example: Connecting to MySql Database

Create a connection to your MySql database, as shown below:


static void Main() {
    string conn = DevExpress.Xpo.DB.MySqlConnectionProvider.GetConnectionString(
        "ServerName", "UserName", "Password", "DatabaseName");
    XpoDefault.DataLayer = XpoDefault.GetDataLayer(conn, AutoCreateOption.DatabaseAndSchema);
    Application.Run(new MainForm());
}
See Also