XAF0013: Avoid reading the XafApplication.ConnectionString property
Severity: Error
When you get the XafApplication.ConnectionString property value, XAF removes all sensitive information (like login and password) from the property value.
You can use the property value if your code does not require the user name and password. In this case, you can suppress the issue.
Examples
Invalid Code
using DevExpress.ExpressApp;
namespace MySolution.Module.BusinessObjects{
public class TestClass : BaseObject {
public void TestMethod(XafApplication xafApplication) {
// Avoid reading the XafApplication.ConnectionString property
//string connectionString = xafApplication.ConnectionString;
}
}
}
How to Fix
XAF removes the password from the XafApplication.ConnectionString property value for security reasons (to avoid exposure of sensitive information in logs, errors, and so on). You can access an unmodified connection string in the application configuration file. To do this, use the following API:
- ConfigurationManager.ConnectionStrings (WinForms and ASP.NET Web Forms)
- ConfigurationExtensions.GetConnectionString (ASP.NET Core Blazor)