This document describes the PX1029 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1029 | PXGraph instances cannot be used inside DAC properties. |
Error | Unavailable |
PXGraph
instances cannot be initialized or used inside DAC properties for the following reasons:
- DACs are the classes that are used to read and write data. Therefore, for appropriate program architecture and design, DACs cannot contain any business logic.
- Because the instantiation of a graph is an expensive operation and DAC properties are used for reading and writing in different system operations, this approach significantly slows the performance of the application.
To fix this error, you should remove from the DAC property the use of PXGraph
, PXGraphExtension
, or classes derived from either of these.
public class SOShipmentExt : PXCacheExtension<SOOrder>
{
public abstract class shipmentNbrExt : IBqlField { }
[PXInt]
[PXUIField(DisplayName = "Shipment Number")]
public virtual int? ShipmentNbrExt
{
get
{
SOOrderMaintSync graph = PXGraph.CreateInstance<SOOrderMaintSync>(); // The PX1029 error is displayed for this line.
return graph.CountSyncReadyFiles(); // Another PX1029 error is displayed for this line.
}
}
}
public class SOOrderMaintSync : PXGraph<SOOrderMaintSync>
{
public int CountSyncReadyFiles(int filesNbr = 0)
{
return filesNbr;
}
}