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'
OR
SELECT
[viewRegisters].[Id] AS [IdRegister]
WHERE Name LIKE 'a%b%c'
OR
SELECT
[viewRegisters].[Id] AS [IdRegister]
WHERE Name LIKE 'a%b%c%'
I'm using .Net Framework 4.0, Entity Framework v4.1 and C#.
EF v4.1 converts this type of linq queries from:
((IQueryable<T>)Data).Where(z => z.Field.Contains("a%b%c%"));
Into:
SELECT
[viewRegisters].[Id] AS [Id]
WHERE Name LIKE N'a~%b~%c~%' ESCAPE N'~'
That's not what I want. I want to be able to use the 'percent' symbol as I do directly in DB.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…