Skip to content

Instantly share code, notes, and snippets.

Avatar
😎

Rodrigo Kono rodrigokono

😎
View GitHub Profile
@rodrigokono
rodrigokono / gist:2907855
Created Jun 11, 2012
IQueryable Dynamic Expressions
View gist:2907855
public static class QueryableExtensions
{
public static IQueryable<T> Filter<T>(this IQueryable<T> queryable, IEnumerable<KeyValuePair<string, string>> filters) where T : class
{
foreach (var filter in filters)
{
var propertyName = typeof(T).GetProperties().Select(x => x.Name).SingleOrDefault(x => x.ToLower() == filter.Key.ToLower());
if (propertyName.IsNullOrWhiteSpace()) continue;
var parameterExpression = Expression.Parameter(typeof(T));
var propertyExpression = Expression.Property(parameterExpression, propertyName);
View "devenv.exe.config"
<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy usesystemdefault="True" />
</defaultProxy>
<settings>
<ipv6 enabled="true"/>
<servicePointManager expect100Continue="false" />
</settings>
</system.net>