How to make a simple search function in linq and EF
I want to simply search a database for a certain string, how c开发者_如何转开发an 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)
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.
精彩评论