Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 1.94 KB

PX1085.md

File metadata and controls

35 lines (28 loc) · 1.94 KB

PX1085

This document describes the PX1085 diagnostic.

Summary

Code Short Description Type Code Fix
PX1085 BQL statements and other database queries should not be executed during the PXGraph initialization. Warning (ISV Level 1: Significant) Unavailable

Diagnostic Description

BQL statements and other database queries (such as PXDatabase.Select) should not be executed during the PXGraph initialization (that is, in PXGraph constructors, in the Initialize method overridden in PXGraphExtension, or in handlers subscribed at run time through the static InstanceCreated member of PXGraph). The execution of database queries during the PXGraph initialization slows the performance of the application.

To address the warning, you should remove the execution of the database query from PXGraph initialization and rework the related business logic.

This diagnostic is displayed only if the Enable additional diagnostics for ISV Solution Certification option (in Tools > Options > Acuminator > Code Analysis) is set to True.

Example of Code that Results in the Warning

public class BranchMaintExtension : PXGraphExtension<BranchMaint>
{
    public override void Initialize()
    {
        List<string> values = new List<string>();
        List<string> labels = new List<string>();
        foreach (PRComboList item in PXSelect<PRComboList, //The PX1085 error is displayed for this line.
            Where<PRComboList.prVariableName, Equal<Required<PRComboList.prVariableName>>>>
            .Select(Base, "PrStateCode"))
        {
            values.Add(item.PrValueType);
            labels.Add(item.PrValueName);
        }
    }
}