Skip to content

Latest commit

 

History

History
82 lines (59 loc) · 3.8 KB

PX1066.md

File metadata and controls

82 lines (59 loc) · 3.8 KB

PX1066

This document describes the PX1066 diagnostic.

Summary

Code Short Description Type Code Fix
PX1066 The name of the BQL field may contain a mistake. Warning (ISV Level 3: Informational) Available

Diagnostic Description

In a DAC, a BQL field (a public abstract class) must have the same name as the corresponding DAC field property but with the first letter in a different case (uppercase for DAC field properties and lowercase for BQL fields). The diagnostic does not check C# properties without Acumatica attributes. These properties are not considered to be DAC field properties.

The PX1066 diagnostic is usually combined with the PX1065 diagnostic. The PX1065 diagnostic reports that the DAC field property does not have a corresponding BQL field. The PX1066 diagnostic amplifies the PX1065 diagnostic by reporting an error if a BQL field has a name close (but not identical) to the name of a DAC field property meaning that this BQL field has a typo in its name.

The PX1066 diagnostic can report an error in another scenario: when the code includes two DACs, one derived from another, and the derived DAC contains a BQL field without a corresponding property. The diagnostic will try to check whether there is a typo in this BQL field and suggest names of DAC field properties from the base DAC.

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 changes the name of the BQL field in the solution so that it matches the name of the DAC field property.

Example of Incorrect Code

[PXHidden]
public class Dac : PXBqlTable, IBqlTable
{
	public abstract class nteID : PX.Data.BQL.BqlGuid.Field<nteID> { }

	[PXGuid]
	public Guid? NoteID { get; set; }
}

Example of the Code Fix

[PXHidden]
public class Dac : PXBqlTable, IBqlTable
{
	public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }

	[PXGuid]
	public Guid? NoteID { get; set; }
}

Related Articles