public static LinqToSolrFilter Create(LambdaExpression fieldExp, params object[] values) { var o = new LinqToSolrFilter(); var fb = fieldExp.Body as MemberExpression; if (fb != null) { #if NET40 || NET35 || PORTABLE40 var dataMemberAttribute = Attribute.GetCustomAttribute(fb.Member, typeof(JsonPropertyAttribute), true) as JsonPropertyAttribute; #else var dataMemberAttribute = fb.Member.GetCustomAttribute <JsonPropertyAttribute>(); #endif o.Name = !string.IsNullOrEmpty(dataMemberAttribute?.PropertyName) ? dataMemberAttribute.PropertyName : fb.Member.Name; o.Values = values.ToArray(); return(o); } return(null); }
public static LinqToSolrFilter Create(Type objectType, string field, params object[] values) { var o = new LinqToSolrFilter(); #if NETCORE || PORTABLE var prop = objectType.GetRuntimeProperty(field); #else var prop = objectType.GetProperty(field); #endif #if NET40 || NET35 || PORTABLE40 var dataMemberAttribute = Attribute.GetCustomAttribute(prop, typeof(JsonPropertyAttribute), true) as JsonPropertyAttribute; #else var dataMemberAttribute = prop.GetCustomAttribute <JsonPropertyAttribute>(); #endif o.Name = !string.IsNullOrEmpty(dataMemberAttribute?.PropertyName) ? dataMemberAttribute.PropertyName : prop.Name; o.Values = values.ToArray(); return(o); }
public LinqToSolrQuery AddFilter <T>(string field, params object[] values) { Filters.Add(LinqToSolrFilter.Create <T>(field, values)); return(this); }
public LinqToSolrQuery AddFilter(Type objectType, string field, params object[] values) { Filters.Add(LinqToSolrFilter.Create(objectType, field, values)); return(this); }
public LinqToSolrQuery AddFilter(LambdaExpression field, params object[] values) { Filters.Add(LinqToSolrFilter.Create(field, values)); return(this); }