I have some code like this trying to get some data from a Documents table based on some filters passed in (ContentRef and TypeRef)...
public IQueryable<Document> GetFilteredDocuments(bool archived, int? ContentRef, int? TypeRef)
{
return from document in db.Documents
where document.IsArchived == archived
&& (document.ContentRef == ContentRef)
&& (document.TypeRef == TypeRef )
select document;
}
if either ContentRef or TypeRef are null then i dont want it to do a check for if its null i just want it ignored.
eg if both are null my method should return the equiavalent of
return from document in db.Documents
where document.IsArchived == archived
select document;
how can i do this?