XafApplication.ConnectionString Property
Specifies the connection string used to connect to the application’s database or to the Application Server.
Namespace: DevExpress.ExpressApp
Assembly: DevExpress.ExpressApp.v24.1.dll
NuGet Package: DevExpress.ExpressApp
#Declaration
#Remarks
Your application may have different connection strings for different scenarios (for example, a specific string for each compilation mode). When you create a new XAF application, the Solution Wizard generates the connection strings for Microsoft SQL Server Express LocalDB. To customize the autogenerated connection strings or create a new string, open the application configuration file and navigate to its connectionStrings section. For more information, refer to the following help topic: Connect an XAF Application to a Database Provider.
The XafApplication.ConnectionString property allows you to choose a specific connection string for your application. The following example demonstrates how to specify this property for a WinForms application:
static class Program {
static void Main() {
//...
MySolutionWindowsFormsApplication application = new MySolutionWindowsFormsApplication();
application.ConnectionString =
ConfigurationManager.ConnectionStrings["ConnectionStringForDevelopment"].ConnectionString;
//...
application.Setup();
//...
}
}
Note
XAF removes the password from the Xaf
- Configuration
Manager. (WinConnection Strings Forms and ASP. NET Web Forms) - Configuration
Extensions. (ASP.Get Connection String NET Core Blazor)
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ConnectionString 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.