Zulander
Zulander

Reputation: 824

Equivalent of SqlFunctions in EF Core

What is the equivalent of SqlFunctions in Entity Framework (EF) Core 2.0?

I am trying to convert this to EF Core

private static readonly MethodInfo StringConvertMethodDouble = typeof(SqlFunctions).GetMethod("StringConvert", new Type[] { typeof(double?) });

Edit #1: I should specify that I am generating a dynamic linq query with expression tree to query the database

Thanks

Upvotes: 26

Views: 12815

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100581

EF Core surfaces functions via EF.Functions, however in 2.0 only Like is available:

ctx.TestEntities.Any(entity => EF.Functions.Like(entity.Name, "%foo%"))

Upvotes: 27

Related Questions