Skip to content

Latest commit

 

History

History
79 lines (57 loc) · 3.97 KB

PX1065.md

File metadata and controls

79 lines (57 loc) · 3.97 KB

PX1065

This document describes the PX1065 diagnostic.

Summary

Code Short Description Type Code Fix
PX1065 The DAC field property does not have a corresponding BQL field. Error Available

Diagnostic Description

Acumatica Framework requires that all DAC field properties have a corresponding BQL field (a public abstract class) in the DAC. A missing BQL field may cause runtime errors or unexpected behavior in numerous places in the application code of Acumatica ERP.

The PX1065 diagnostic checks whether the DAC field property has a corresponding BQL field in the definition of the DAC or in its base DACs.

For DAC extensions, the diagnostic checks whether the DAC field property has a corresponding BQL field in the following locations:

  • The DAC extension itself and the base DACs from which it is derived
  • The base DAC of the DAC extension and the DACs from which the base DAC has been derived
  • The lower-level DAC extensions to which the DAC extension is chained

Terminology

Note

This section is a reminder about the terminology used in the diagnostic description. You can skip it if you are already familiar with this terminology.

A DAC field property is any C# property declared in a DAC that has attributes derived from PX.Data.PXEventSubscriberAttribute such as PXDBBool or PXInt. These attributes are sometimes referred to as Acumatica attributes.

A BQL field is a public abstract class that implements the PX.Data.IBqlField interface. It usually has a corresponding DAC field property that has the same name but in a different casing. Usually, BQL fields use camelCasing, and field properties use PascalCasing. Together this pair forms a DAC field. The following code shows an example of a DAC field.

public class DAC : PXBqlTable, IBqlTable
{
    public abstract class orderNbr : PX.Data.BQL.BqlString.Field<orderNbr> { }  // The BQL field that corresponds to the DAC field property, which follows

	[PXDBString( IsKey = true, IsUnicode = true, InputMask = ">CCCCCC")]		// The Acumatica attribute
	public virtual string OrderNbr { get; set; }								// The DAC field property 


	// Not a DAC field property at all
	public string SomeProperty  
	{ 
		get; 
		set;
	}
}

Code Fix Description

The code fix adds a missing BQL field in the DAC near the corresponding DAC field property. The code fix is available only for properties with missing BQL fields that are declared in the DAC or DAC extension. If the DAC field property with a missing BQL field is declared in a base class, the error is shown on the DAC name, and the code fix is not available.

Example of Incorrect Code

public class DAC : PXBqlTable, IBqlTable
{
	[PXDBString( IsKey = true, IsUnicode = true, InputMask = ">CCCCCC")]	// The DAC field property without a corresponding BQL field
	public virtual string OrderNbr { get; set; }							// The PX1065 error is displayed on the "OrderNbr" field
}

Example of the Code Fix

public class DAC : PXBqlTable, IBqlTable
{
	public abstract class orderNbr : PX.Data.BQL.BqlString.Field<orderNbr> { }		// The added BQL field

	[PXDBString( IsKey = true, IsUnicode = true, InputMask = ">CCCCCC")]
	public virtual string OrderNbr { get; set; }
}

Related Articles