How do I have to build my query to result in an output SQL query like:
SELECT
[viewRegisters].[Id] AS [IdRegister]
WHERE Name LIKE \'%a%bc\'
<
If you are using SQL Server, use the PATINDEX function to do a pattern search. You can access this function through EF using the SqlFunctions class.
For example, the following EF query
context.ViewRegisters.Where(z => SqlFunctions.PatIndex("a%b%c%", z.Name) > 0);
will translate into
SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Name] AS [Name]
FROM [dbo].[ViewRegisters] AS [Extent1]
WHERE (CAST(PATINDEX(N'a%b%c%', [Extent1].[Name]) AS int)) > 0