In T-SQL, I can do this:
declare @a varchar(500) = 'aaip'
select 1 where @a like '_ip'
In Entity Framework, it seems I can only use contain, which will be translated to percent sign (%). Is there a way to create like statement with underscore? There is a 2017 stackoverflow question on this and the answer is a NO, just wondering if there are some better ways now.
CodePudding user response:
Entity Framework Core's SQL Server provider has mapping for DbFunctionsExtensions.Like
method. Something like .Where(e => EF.Functions.Like(e.SomeColumn, "_p"))
should do the trick.