troubleshooting Question

Building dynamic linq query

Avatar of scottlafoy
scottlafoyFlag for Canada asked on
Microsoft Development.NET ProgrammingC#
10 Comments1 Solution424 ViewsLast Modified:
I am looking to use linq on a forms project I am building for a search page I need. My project is organized into 1 object containing a collection of licenses and a collection of inspections. The license and inspections have a relationship of 1 to many. There is only 1 license per inspection but a license can belong to many inspections. I am building a search page that has many many different items that can be used to search. It can use either all of them or any 1 or combination of the search items to search. The tricky part is the search has to return a collection of inspections although half of the search items are properties in the license object and not the inspection object. Now since it would be totally crazy to build a massive switch statement to do all of this I need a starting point. How do I create a dynamic linq query?  I have not used linq yet but I have read up on using it with objects and I think I get a basic understanding of it.  If anyone could offer me some help I would be grateful.

Thank you in advance,

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros