What Changed
In v.20.2, ASP.NET Blazor and Web Forms apps will throw exceptions if a business object type displayed in a ListView does not have a public Key Property.
Reasons for Change
A business class without a public key property may cause issues with selection, filtering, etc. in a web ListView due to a different control architecture in client-server apps (it may work fine in WinForms). For more information, see Web - How to avoid issues with data-bound controls due to missing or non-unique key values.
Previously, these issues could appear in unexpected places without developers knowing about them. We decided to throw exceptions once such situations are detected to save developers and end-users from more serious issues in production.
Impact on Existing Apps
This change will affect your ASP.NET Web Forms and Blazor apps if you are using an object without a key in your ListView. This may often happen with non-persistent classes.
If your class is non-persistent, inherit it from DevExpress.ExpressApp.NonPersistentBaseObject or declare a public key property with DevExpress.ExpressApp.Data.KeyAttribute. For more solutions, see Web - How to avoid issues with data-bound controls due to missing or non-unique key values.
How to Revert to Previous Behavior
In the YourSolutionName.Xxx/XxxApplication.xx file, override the following method in your WebApplication or BlazorApplication descendant:
C#protected override bool ThrowIfNoKeyOnListViewCreation(DC.ITypeInfo typeInfo) {
return false;
}
Visual BasicProtected Overrides Function ThrowIfNoKeyOnListViewCreation(ByVal typeInfo As DC.ITypeInfo) As Boolean
Return False
End Function