[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Collapse]eXpress Persistent Objects
 [Expand]Product Information
 [Expand]Getting Started
 [Collapse]Feature Center
  [Expand]Data Representation
  [Expand]Object Relational Mapping
  [Expand]Connecting to a Data Store
  [Expand]Data Exchange and Manipulation
  [Expand]Querying a Data Store
  [Collapse]Using XPO in Web Applications
    Connecting XPO to a Database Server (ASP.NET)
 [Expand]Design-Time Features
 [Expand]Member Tables
 [Expand]API Reference
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Connecting XPO to a Database Server (ASP.NET)

To access a database server using XPO, a Data Access Layer needs to be created and provided with connection settings. To accomplish this in an ASP.NET application, place the construction code into the Application_Start event handler in the Global.asax module of your Web Site. For information on how to add the Global.asax module to the Web Site, see Tutorial 6 - A Simple Guestbook (ASP.NET).


When designing ASP.NET applications, using the ThreadSafeDataLayer object is recommended.

Handle the Web form's Page_Init event to create a session for the XpoDataSource component. The session must be linked to the Data Layer:


When designing multi-user ASP.NET applications based on XPO, it's recommended to create an XPO session for each request. Create a new session for each page, and dispose of it by overriding the Page.Render method.

Expanded See Also

Is this topic helpful?​​​​​​​