This document describes the PX1117 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1117 | The type hierarchy of the DAC extension contains an extension that extends multiple independent DAC extensions. Extending multiple independent DAC extensions is forbidden for DAC extensions. | Error | Unavailable |
The PX1117 diagnostic detects and reports DAC extensions that have a complex type hierarchy containing multiple independent base DAC extensions. In Acumatica Framework, DAC extensions can only have a linear inheritance chain. A DAC extension that attempts to extend multiple independent DAC extensions simultaneously (through chaining in the generic type parameters) creates an invalid and unsupported type hierarchy.
The term extension type hierarchy has a specific meaning within the Acumatica Framework different from the regular C# type hierarchy.
In Acumatica Framework, extensions can extend other extensions through two mechanisms:
- Inheritance (only for graph extensions): When a graph extension class directly inherits from another graph extension class (for example,
class ExtensionB : ExtensionA). The inheritance is forbidden for DAC extensions. - Chaining also called higher-level extension: When an extension declares other extensions as type parameters in the base generic extension type (for example,
class ExtensionA : PXGraphExtension<ExtensionB, MyGraph>).
The extension type hierarchy in Acumatica Framework is a set of all types extended by the extension through these two mechanisms. This hierarchy can be represented as a diagram where nodes are extension types, and edges represent "extends" relationships (either through inheritance or chaining).
An extension type hierarchies in Acumatica Framework can be classified into two categories based on its structure:
- Linear Extension Type Hierarchy: A type hierarchy where each extension extends no more than one independent extension and its base extensions, forming a single chain of extensions. For example:
SomeGraph : PXGraph<SomeGraph>
|
ExtensionA : PXGraphExtension<SomeGraph>
|
ExtensionB : PXGraphExtension<ExtensionA, SomeGraph>
|
ExtensionC : PXGraphExtension<ExtensionB, ExtensionA, SomeGraph>- Complex Extension Type Hierarchy: A type hierarchy where an extension extends multiple independent extensions, creating branches in the hierarchy. For example:
// ExtensionA and ExtensionB are independent extensions
ExtensionA : PXGraphExtension<SomeGraph>
ExtensionB : PXGraphExtension<SomeGraph>
SomeGraph
/ \
ExtensionA ExtensionB
\ /
ExtensionC : PXGraphExtension<ExtensionB, ExtensionA, SomeGraph>Unlike graph extensions, which support complex type hierarchies, DAC extensions are restricted to only linear hierarchies. The restriction exists due to impossible ambiguities and conflicts that arise on attempt to combine multiple independent DAC extensions with the same DAC field.
[PXHidden]
public class MyDac : PXBqlTable, IBqlTable
{
// DAC fields
}
// Two independent DAC extensions extending the same DAC
public sealed class FirstIndependentDacExtension : PXCacheExtension<MyDac>
{
// Extension DAC fields
}
public sealed class SecondIndependentDacExtension : PXCacheExtension<MyDac>
{
// Extension DAC fields
}
// This DAC extension attempts to extend both independent DAC extensions - reports PX1117
public sealed class CombinedDacExtension : PXCacheExtension<SecondIndependentDacExtension, FirstIndependentDacExtension, MyDac>
{
// Extension DAC fields
}