Suppose something like this :
public static IQueryable<T> Find<T>(IQueryable<T> query, string value, params Expression<Func<T, object>>[] subSelectors) where T : class
{
foreach (var include in subSelectors)
{
var entityType = include.Body.Type.GetGenericArguments().First();
var properties = from p in entityType.GetProperties()
where Attribute.IsDefined(p, typeof(FilterAttribute))
select p;
}
}
This method is called from another assembly, exemple call of this method :
var container = new List<MyClass>();
var q = (from m in container
select m).AsQueryable();
SimpleFilter.Find(q, "something", m => m.Navigation);
For the T parameter is ok I see my custom attribute. But form the lambda expression I cant see my custom attribute.
entityTypeis simpler astypeof(T)here, no?