expressappframework-405499-debugging-testing-and-error-handling-code-diagnostics-xaf0033.md
Severity: Warning
XAF and EF Core do not support the following business object’s properties:
new keywordFor more information about these requirements, see the following article: Can I override properties of business objects?.
This diagnostic works only for EF Core classes derived from the DevExpress.Persistent.BaseImpl.EF.BaseObject class. This diagnostic does not check static properties.
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl.EF;
namespace MySolution.Module.BusinessObjects {
public class TestClass : BaseObject {
private int testProperty1;
// The property must not override a property from a base class
public override int TestProperty1 { // Warning: XAF0033
get { return testProperty1 + 1; }
set { SetPropertyValue(nameof(TestProperty1), ref testProperty1, value); }
}
private int testProperty2;
// The property must not be declared with the `new` keyword
public new int TestProperty2 { // Warning: XAF0033
get { return testProperty2 + 1; }
set { SetPropertyValue(nameof(TestProperty2), ref testProperty2, value); }
}
}
}
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl.EF;
namespace MySolution.Module.BusinessObjects {
public class TestClass : BaseObject {
private int testProperty;
// The property that meets the requirements
public int TestProperty {
get { return testProperty; }
set { SetPropertyValue(nameof(TestProperty), ref testProperty, value); }
}
}
}
Check the business object’s property declaration and ensure the property is declared without the following modifiers:
abstractoverridenew