LINQ to SQL dynamic WHERE clause mulitple JOIN

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jay Douglas

    LINQ to SQL dynamic WHERE clause mulitple JOIN

    Hello,

    I've found some posts on creating dynamic WHERE clauses in LINQ to SQL using
    predicate builders and extending lamda expressions. One issue with these
    posts is all the examples only use a single customer table. I'm need a way
    to dynamically create a where clause using multiple tables. None of the
    tables I'm using have references in the LINQ designer so the JOIN operator
    is required.

    If I were to hard type out the query in linq it would look like: (Just an
    example, I don't have the NWind schema in front of me)

    var query = from c in db.Customers join o in db.Orders on c.CustomerId
    equals o.CustomerId where c.LastName.Cont ains("Last") && o.OrderDate new
    DateTime("1/1/2001") select c;

    I'm looking for some direction on dynamically setting the where predicates.

    Any and all suggestions and GREATLY appreciated.

    Many thanks in advance.

    Jay Douglas

Working...