31 Mayıs 2016 Salı

Entity Framework ile tüm kolonlarda aynı anda arama yapmak


var stringProperties = typeof(Customer).GetProperties().Where(prop =>
    prop.PropertyType == query.GetType());
 

context.Customer.Where(customer => 
    stringProperties.Any(prop =>
        prop.GetValue(customer, null) == query));

Hiç yorum yok:

Yorum Gönder