Here is the situation:
I have a webpage that I cleared as a string.
I have several fields in an MSSQL database. For example, a car model, it has an identifier and a name, for example, Mustang or Civic. It is pre-populated with most car models.
I want to find any match for any row in my model table. Therefore, if I have Civic, Mustang and E350 in my model table, I want to find any information about any of the three on the page that I cleared.
What is an effective way to do this in C #. I am using LINQ to SQL to interact with db.
Does the dictionary of all models, page tokenization, and iteration through tokens make sense? Or should I just iterate over the tokens and use the WHERE clause and query the database if there is a match?
//Dictionary dic contains all models from the DB, with the name being the key and the id being the value... foreach(string pageToken in pageTokens) { if(dic.ContainsKey(pageToken)) { //Do what I need to do } }
Both of these methods seem terrible to me. Any suggestions on what I should do? Something with an established intersection, I would think maybe nice?
None of these methods relate to what happens when the model name has more than one word ... for example, "F150 Extended Cab". Thoughts on this?
Jason source share