The answer of @adiga is quite incomplete and covers just a part of the differences in usage.
However, .StartsWith(...)
, .Contains(...)
and .EndsWith(...)
are also translated differently into SQL then EF.Functions.Like
.
For example .StartsWith
gets translated as (string LIKE pattern + "%" AND CHARINDEX(pattern, string) = 1) OR pattern = ''
where .Contains
gets translated into (CHARINDEX(pattern, string) > 0) OR pattern = ''
.
EF.Functions.Like
however gets translated into string LIKE pattern [ESCAPE escapeChar]
.
This may also have implications on Performance. The above is valid for EF Core SqlServer provider. Other EF Core providers may translate it differently.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…