Linq to Entity Dynamic where clause

Posted by GodSmart on Stack Overflow See other posts from Stack Overflow or by GodSmart
Published on 2010-05-10T18:00:44Z Indexed on 2010/05/10 18:04 UTC
Read the original article Hit count: 232

Filed under:

I have Linq to Entity query like you can see below I am using it five times in my code, everything that change is where clause. is it possible to create a method and pass just where values, not to write all code five times. Thank you

    items = from t1 in _entities.table1
                      join t2 in _entities.Table2 on t1.column1 equals t2.column1
                      join t3 in _entities.Table3 on t1.column2 equals t3.column2
                      join t4 in _entities.Table4 on t1.column3 equals t4.column3

                      where **t1.column5 == Something**
                      select new
                                 {
                                    t1.column7,
                                    t2.column8,                                        
                                    t3.column9,
                                    t4.column10

                                 };

© Stack Overflow or respective owner

Related posts about linq-to-entities