Skip to content

Latest commit

 

History

History
73 lines (63 loc) · 2.07 KB

File metadata and controls

73 lines (63 loc) · 2.07 KB

PX1060

This document describes the PX1060 diagnostic.

Summary

Code Short Description Type Code Fix
PX1060 DAC fields should be strongly typed to be used in fluent BQL queries. Warning Available

Diagnostic Description

The PX1061 diagnostic detects weakly-typed DAC BQL fields that do not support FBQL queries.

Each DAC BQL field (that is, each public abstract class of a DAC) that is used in fluent BQL is strongly typed, which makes it possible to perform compile-time code checks in Visual Studio. In fluent BQL, you derive class fields not from the IBqlField interface (as you would in traditional BQL) but from the specific fluent BQL classes that correspond to the type of the property field.

Code Fix

The PX1060 code fix changes PX.Data.IBqlField to PX.Data.BQL.Bql[Type].Field<productID>, where [Type] is one of the following: Bool, Byte, Short, Int, Long, Float, Double, Decimal, Guid, DateTime, String, or ByteArray.

Example of Code that Results in the Message

public class Product : PX.Data.PXBqlTable, PX.Data.IBqlTable
{
	#region ProductID
	public abstract class productID : PX.Data.IBqlField // The PX1060 message is displayed for this line.
	{
	}
	protected int? _ProductID;
	[PXDBIdentity]
	public virtual int? ProductID
	{
		get
		{
			return this._ProductID;
		}
		set
		{
			this._ProductID = value;
		}
	}
	#endregion
}

Example of Code Fix

public class Product : PX.Data.PXBqlTable, PX.Data.IBqlTable
{
	#region ProductID
	public abstract class productID : PX.Data.BQL.BqlInt.Field<productID> 
	{
	}
	protected int? _ProductID;
	[PXDBIdentity]
	public virtual int? ProductID
	{
		get
		{
			return this._ProductID;
		}
		set
		{
			this._ProductID = value;
		}
	}
	#endregion
}

Related Articles