EF.Constant<T>(T) Method

Definition

Within the context of an EF LINQ query, forces its argument to be inserted into the query as a constant expression. This can be used to e.g. integrate a value as a constant inside an EF query, instead of as a parameter, for query performance reasons.

C#
public static T Constant<T> (T argument);

Type Parameters

T

The type of the expression to be integrated as a constant into the query.

Parameters

argument
T

The expression to be integrated as a constant into the query.

Returns

T

The same value for further use in the query.

Remarks

Note that this is a static method accessed through the top-level EF static type.

Applies to

Toode Versioonid
Entity Framework Core 9.0