expressappframework-403424-debugging-testing-and-error-handling-code-diagnostics-xaf0004.md
Severity: Warning
XAF has the following requirements for Controllers:
This diagnostic works only for classes derived from the DevExpress.ExpressApp.Controller class.
This diagnostic does not work for abstract classes and constructors that have ActivatorUtilitiesConstructorAttribute.
using DevExpress.ExpressApp;
using DevExpress.Persistent.BaseImpl;
namespace MySolution.Module.Controllers{
public class ExampleClass1 : Controller {
// The constructor must be public
ExampleClass1 () {} // Warning: XAF0004
}
public class ExampleClass2 : Controller {
public ExampleClass2 (IXafApplicationProvider appProvider){} // Warning: XAF0004
}
// ...
}
using DevExpress.ExpressApp;
using DevExpress.Persistent.BaseImpl;
namespace MySolution.Module.Controllers {
public class ExampleClass1 : Controller {
// This constructor meets the requirements
public ExampleClass1() {}
}
// Even though the Controller class and its constructor are not public, this implementation meets the requirements
class ExampleClass2 : Controller {
internal ExampleClass2(string theParameter) { }
}
// ...
ShowViewParameters showViewParameters = /*...*/;
showViewParameters.Controllers.Add(new ExampleClass2("MyParameter"));
// ...
}