Back to Devexpress

XafApplication.Connection Property

expressappframework-devexpress-dot-expressapp-dot-xafapplication-ea9f892b.md

latest6.3 KB
Original Source

XafApplication.Connection Property

Specifies the connection to the database used by the application.

Namespace : DevExpress.ExpressApp

Assembly : DevExpress.ExpressApp.v25.2.dll

NuGet Package : DevExpress.ExpressApp

Declaration

csharp
[Browsable(false)]
public IDbConnection Connection { get; set; }
vb
<Browsable(False)>
Public Property Connection As IDbConnection

Property Value

TypeDescription
IDbConnection

A IDbConnection object representing an open connection to a data source.

|

Remarks

To set the appropriate connection, specify the Connection property in code between the XafApplication object’s creation and setup:

csharp
static void Main() {
   //...
   MySolutionWindowsFormsApplication application = new MySolutionWindowsFormsApplication();
   application.Connection = new OracleConnection(...);
   application.Setup();
   //...
}

By default, SQL connection is used.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Connection property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

xaf-how-to-import-data-in-xaf/CS/WinWebSolution.Web/ApplicationCode/WebApplication.cs#L67

csharp
this.ApplicationName = "WinWebSolution";
this.Connection = this.sqlConnection1;
this.Modules.Add(this.module1);

xaf-how-to-create-information-panels/CS/InfoPanels.Web/WebApplication.cs#L68

csharp
this.ApplicationName = "InfoPanels";
this.Connection = this.sqlConnection1;
this.Modules.Add(this.module1);

xaf-how-to-implement-a-custom-security-operation-that-can-be-permitted-at-the-type-level/CS/CustomSecurityOperation.Web/WebApplication.cs#L62

csharp
this.ApplicationName = "CustomSecurityOperation";
this.Connection = this.sqlConnection1;
this.Modules.Add(this.module1);

xaf-how-to-display-an-enumeration-property-as-a-drop-down-box-with-check-boxes/CS/E689.Web/WebApplication.cs#L68

csharp
this.ApplicationName = "E689";
this.Connection = this.sqlConnection1;
this.Modules.Add(this.module1);

xaf-how-to-access-a-tab-control-in-a-detail-view-layout/CS/E372.Web/WebApplication.cs#L58

csharp
this.ApplicationName = "E372";
this.Connection = this.sqlConnection1;
this.Modules.Add(this.module1);

xaf-how-to-import-data-in-xaf/VB/WinWebSolution.Web/ApplicationCode/WebApplication.vb#L69

vb
Me.ApplicationName = "WinWebSolution"
Me.Connection = Me.sqlConnection1
Me.Modules.Add(Me.module1)

xaf-how-to-use-data-from-security-in-criterion/VB/CustomFunctionCriteriaOperator.Web/WebApplication.vb#L73

vb
Me.ApplicationName = "CustomFunctionCriteriaOperator"
Me.Connection = Me.sqlConnection1
Me.Modules.Add(Me.module1)

xaf-how-to-create-information-panels/VB/InfoPanels.Web/WebApplication.vb#L59

vb
Me.ApplicationName = "InfoPanels"
Me.Connection = Me.sqlConnection1
Me.Modules.Add(Me.module1)

xaf-how-to-implement-a-custom-security-operation-that-can-be-permitted-at-the-type-level/VB/CustomSecurityOperation.Web/WebApplication.vb#L63

vb
Me.ApplicationName = "CustomSecurityOperation"
Me.Connection = Me.sqlConnection1
Me.Modules.Add(Me.module1)

xaf-how-to-display-an-enumeration-property-as-a-drop-down-box-with-check-boxes/VB/E689.Web/WebApplication.vb#L59

vb
Me.ApplicationName = "E689"
Me.Connection = Me.sqlConnection1
Me.Modules.Add(Me.module1)

See Also

XafApplication Class

XafApplication Members

DevExpress.ExpressApp Namespace