Is there a way to add or remove a line of an LINQ to DB Query based on if the value being checked is

Posted by RandomBen on Stack Overflow See other posts from Stack Overflow or by RandomBen
Published on 2010-03-29T15:50:22Z Indexed on 2010/03/29 15:53 UTC
Read the original article Hit count: 359

Filed under:
|
|
|

If I have a query like this:

String Category = HttpContext.Current.Request.QueryString["Product"].ToString();

IQueryable<ItemFile> pressReleases = from file in connection.ItemFile
                                                           where file.Type_ID == 8
                                                                && file.Category == Category 
                                                           select file;

Is there a way to make this LINQ Query so that I do no use the line file.Category == Category if Category is null or empty?

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ