/// <summary> /// Find all Members that are accessed in key function /// </summary> /// <typeparam name="T">Type of row object that contains the key</typeparam> /// <typeparam name="TKey">Type of the key that is created</typeparam> /// <param name="keyExtractExpression">Expression to function that explains the key from <typeparamref name="T"/></param> /// <returns>The collection of membernames that are used in Keys</returns> public static IReadOnlyCollection <string> GetMembers <T, TKey>(this Expression <Func <T, TKey> > keyExtractExpression) { var visitor = new KeyVisitor(keyExtractExpression.Parameters.First()); visitor.Visit(keyExtractExpression.Body); return(visitor.Members); }
public static List <PropertyInfo> GetKeys <T>(Expression <Func <T, object> > getKey) { var vis = new KeyVisitor(); vis.Visit(getKey); return(vis.PropertyInfos); }