public static object Evaluate <T>(this Session session, Expression <Func <T, object> > field, Aggregate aggregate, Func <Expression <Func <T, bool> > > filter = null) { filter ??= () => arg => true; return(session.Evaluate(typeof(T), CriteriaOperator.Parse($"{aggregate}({field.MemberExpressionName()})"), CriteriaOperator.FromLambda(filter()))); }
private static string GetRoleCriteria(string roleName) => CriteriaOperator.FromLambda <IPermissionPolicyRole>(role => role.Name == roleName).ToString();