Skip to content

Latest commit

 

History

History
68 lines (59 loc) · 1.96 KB

PX1060.md

File metadata and controls

68 lines (59 loc) · 1.96 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. Message Available

Diagnostic Description

Each class field of a DAC (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.

The 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