This document describes the PX1061 diagnostic.
| Code | Short Description | Type | Code Fix |
|---|---|---|---|
| PX1061 | Constants should be strongly typed to be used in fluent BQL queries. | Warning | Available |
The PX1061 diagnostic detects weakly-typed BQL constants that do not support fluent BQL queries.
Constants that are used in fluent BQL are strongly typed, which makes it possible to perform compile-time code checks in Visual Studio. In fluent BQL, you derive constants not from the Constant<Type> class
(as you would in traditional BQL) but from the specific fluent BQL classes that correspond to the C# type of the constant.
The PX1061 code fix changes PX.Data.Constant<Type> to PX.Data.BQL.Bql[Type].Constant<TSelf>, where [Type] is one of the following:
Bool, Byte, Short, Int, Long, Float, Double, Decimal, Guid, DateTime, String, or ByteArray.
public class decimal_0 : PX.Data.Constant<Type> // The PX1061 message is displayed for this line.
{
public decimal_0()
: base(0m)
{
}
}public class decimal_0 : PX.Data.BQL.BqlDecimal.Constant<decimal_0>
{
public decimal_0()
: base(0m)
{
}
}