This document describes the PX1067 diagnostic.
Code | Short Description | Type | Code Fix |
---|---|---|---|
PX1067 | The DAC does not contain a redeclaration of a BQL field declared in the base DAC. | Warning (ISV Level 3: Informational) | Available |
In Acumatica Framework, BQL fields from a base DAC should be redeclared in the derived DAC. If a BQL field was not redeclared in the derived DAC, using this field in a BQL query with a derived DAC can lead to a runtime error. The PX1067 diagnostic reports a warning if a DAC does not contain a redeclaration of a BQL field that is declared in the base DAC.
This diagnostic reports a warning instead of an error because the absence of a BQL field redeclaration in a derived DAC does not always lead to a runtime error. An error will happen only if the BQL field is used in a BQL query with the derived DAC. However, the best practice is to redeclare all BQL fields in the derived DAC because they can be always used in a BQL query with the derived DAC in an external customization.
The code fix adds the redeclaration of a BQL field declared in the base DAC to the derived DAC. If the BQL field in the base DAC is weakly typed (for example, if it only implements the PX.Data.IBqlField
interface), the code fix will attempt to add a strongly typed declaration of the BQL field. The type of the BQL field will be deduced from the corresponding DAC field property type.
[PXHidden]
public class DerivedDac : BaseDac
{
}
[PXHidden]
public class BaseDac : PXBqlTable, IBqlTable
{
public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
[PXGuid]
public Guid? NoteID { get; set; }
}
[PXHidden]
public class DerivedDac : BaseDac
{
public new abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
}
[PXHidden]
public class BaseDac : PXBqlTable, IBqlTable
{
public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
[PXGuid]
public Guid? NoteID { get; set; }
}