Skip to content

Latest commit

 

History

History
46 lines (37 loc) · 2.43 KB

File metadata and controls

46 lines (37 loc) · 2.43 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. The execution of database queries during the PXGraph initialization slows the performance of the application. The following code elements are considered to be a part of the graph initialization:

  • The PXGraph and PXGraphExtension constructors
  • The Initialize method overridden in PXGraphExtension
  • The Initialize method of PXGraph that implements the PX.Data.DependencyInjection.IGraphWithInitialization interface
  • The Configure method overridden in PXGraph and PXGraphExtension

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);
		}
	}
}

Related Articles