Skip to content

Latest commit

 

History

History
40 lines (31 loc) · 1.46 KB

PX1061.md

File metadata and controls

40 lines (31 loc) · 1.46 KB

PX1061

This document describes the PX1061 diagnostic.

Summary

Code Short Description Type Code Fix
PX1061 Constants should be strongly typed to be used in fluent BQL queries. Message Available

Diagnostic Description

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 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.

Example of Code that Results in the Message

public class decimal_0 : PX.Data.Constant<Type> // The PX1061 message is displayed for this line.
{ 
  public decimal_0()
    : base(0m)
  {
  }
}

Example of Code Fix

public class decimal_0 : PX.Data.BQL.BqlDecimal.Constant<decimal_0> 
{ 
  public decimal_0()
    : base(0m)
  {
  }
}

Related Articles