Created
December 23, 2014 20:42
-
-
Save JamesGould123/e3d7dd50132de72c3c38 to your computer and use it in GitHub Desktop.
LINQ to Entities Contains bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string queryStr = "AB7"; | |
var viewModel5 = (from n in db.TableName | |
where n.TableCol.Contains("AB7") | |
select n.TableCol); //running ToList with this returns 35 results | |
//viewModel5 = {SELECT | |
//`Extent1`.`TableCol` | |
//FROM `TableName` AS `Extent1` | |
//WHERE `Extent1`.`TableCol` LIKE '%AB7%'} | |
var viewModel6 = (from n in db.TableName | |
where n.TableCol.Contains(queryStr) | |
select n.TableCol); //running ToList with this returns 0 results | |
//viewModel6 = {SELECT | |
//`Extent1`.`TableCol` | |
//FROM `TableName` AS `Extent1` | |
//WHERE `Extent1`.`TableCol` LIKE '%p__linq__0%'} | |
var strEqualsStr = "AB7" == queryStr; //true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment