Class DbFunctionsExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.dll
Provides CLR methods that get translated to database functions when used in LINQ to Entities queries. The methods on this class are accessed via Functions.
public static class DbFunctionsExtensions
- Inheritance
-
DbFunctionsExtensions
- Inherited Members
Remarks
See Database functions for more information and examples.
Methods
Like(DbFunctions, string?, string?)
An implementation of the SQL LIKE
operation. On relational databases this is usually directly
translated to SQL.
public static bool Like(this DbFunctions _, string? matchExpression, string? pattern)
Parameters
_
DbFunctionsThe DbFunctions instance.
matchExpression
stringThe string that is to be matched.
pattern
stringThe pattern which may involve wildcards
%,_,[,],^
.
Returns
Remarks
Note that the semantics of the comparison will depend on the database configuration. In particular, it may be either case-sensitive or case-insensitive.
This DbFunction method has no in-memory implementation and will throw if the query switches to client-evaluation. This can happen if the query contains one or more expressions that could not be translated to the store.
Like(DbFunctions, string?, string?, string?)
An implementation of the SQL LIKE operation. On relational databases this is usually directly translated to SQL.
public static bool Like(this DbFunctions _, string? matchExpression, string? pattern, string? escapeCharacter)
Parameters
_
DbFunctionsThe DbFunctions instance.
matchExpression
stringThe string that is to be matched.
pattern
stringThe pattern which may involve wildcards %,_,[,],^.
escapeCharacter
stringThe escape character (as a single character string) to use in front of %,_,[,],^ if they are not used as wildcards.
Returns
Remarks
Note that the semantics of the comparison will depend on the database configuration. In particular, it may be either case-sensitive or case-insensitive.
This DbFunction method has no in-memory implementation and will throw if the query switches to client-evaluation. This can happen if the query contains one or more expressions that could not be translated to the store.
Random(DbFunctions)
A random double number generator which generates a number between 0 and 1, exclusive.
public static double Random(this DbFunctions _)
Parameters
_
DbFunctionsThe DbFunctions instance.
Returns
- double
A random double number between 0 and 1, exclusive.
Remarks
This DbFunction method has no in-memory implementation and will throw if the query switches to client-evaluation. This can happen if the query contains one or more expressions that could not be translated to the store.