Composing and executing a customer search I was wondering if someone could help me refactor this code. Although I know this looks bad, it works. Now I would like to refactor it so I would respect the open/closed principle in SOLID. Let's say the client wants a new search field to search data on, then I need to come to this method and add it in and this breaks the O/C principle. How would you guys change this?

public List&lt;Customer&gt; Search(Search searchData){
using(context)
{
    var query = context.Customers;

    if(!string.NullOrEmpty(searchData.FirstName)
        query.Where(c =&gt; c.FirstName == searchData.FirstName);

    if(!string.NullOrEmpty(searchData.LastName)
        query.Where(c =&gt; c.LastName == searchData.LastName);

    if(!string.NullOrEmpty(searchData.StreetName)
        query.Include(c =&gt; c.Address);
        query.Where(c =&gt; c.Address.StreetName == searchData.StreetName);

    if(!string.NullOrEmpty(searchData.PostCode)
        query.Include(c =&gt; c.City);
        query.Where(c =&gt; c.City.PostCode == searchData.PostCode);

    var customers = query.ToList();
    return customers;
}    }
Not sure if you know how dangerous omitting braces for if statements can be. Do you know what happens here :

if(!string.NullOrEmpty(searchData.StreetName)
    query.Include(c =&gt; c.Address);
    query.Where(c =&gt; c.Address.StreetName == searchData.StreetName);


no matter wether searchData.StreetName is null or not the query.Where(c =&gt; c.Address.StreetName == searchData.StreetName); will be executed nevertheless. I assume from the way you have formatted the code that you assume this will be only executed if the condition is true.  

I would like to encourage you to always use braces {} although they might be optional. This helps you to structure your code which helps to make it more readable and by using them you make your code less error prone.