This document describes the PX1113 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1113 | Graphs and graph extensions should not be sealed types. |
Warning | Available |
The PX1113 diagnostic detects graphs and graph extensions marked with the sealed modifier.
Graphs and graph extensions in Acumatica Framework must not be sealed types because the framework's customization mechanism depends on the ability to inherit from and extend existing business logic components.
When the PXGraph.CreateInstance factory method creates a graph instance, the Acumatica ERP runtime dynamically generates derived types from the instantiated graph and its associated graph extensions.
Within these dynamically generated types, the runtime applies and combines logic from applicable graph extensions.
Declaring graphs or graph extensions as sealed prevents this dynamic type generation, making customization impossible and causing runtime errors when attempting to extend such types.
This goes against design best practices of Acumatica Framework which promote extensibility and reusability of business logic. Thus, the PX1113 diagnostic issues a warning for any graph or graph extension declared as sealed.
In a rare scenario when the sealed modifier is intentionally used to prevent the extension of the business logic, developers should suppress the alert from PX1113 diagnostic with Acuminator suppression comment.
The PX1113 code fix automatically removes the sealed modifier from the graph or graph extension declaration.
// Sealed graph - reports PX1113
public sealed class OrderGraph<TOrderDac> : PXGraph<GenericOrderGraph<TOrderDac>>
where TOrderDac : PXBqlTable, IBqlTable, new()
{
// Business logic
}public class OrderGraph<TOrderDac> : PXGraph<GenericOrderGraph<TOrderDac>>
where TOrderDac : PXBqlTable, IBqlTable, new()
{
// Business logic
}