Reputation: 12437
I want to simply search a database for a certain string, how can i accomplish this using linq and EF (if using these tools for it are not practical I am open to any suggestions). I just want to take a string and search my usernames, the search should be able to handle things only parts of the username (using some sort of 'contains' function)
Upvotes: 2
Views: 639
Reputation: 82325
The basics of what you are asking is..
var found = MyContext.Users.Where(user => user.UserName.Contains(searchString));
You would need to substitute actual entity names/values for the example code posted.
Upvotes: 1