public static FluentInclude <T> WithQuery <T, Q>(this FluentInclude <T> fi, DynamicQueryManager dqm, Expression <Func <T, Q> > simpleQuerySelector, Action <AutoDynamicQueryCore <Q> > modifyQuery) where T : Entity { dqm.RegisterQuery <Q>(typeof(T), () => { var autoQuery = DynamicQueryCore.Auto(Database.Query <T>().Select(simpleQuerySelector)); modifyQuery(autoQuery); return(autoQuery); }); return(fi); }
public void Register <T>(object queryName, Func <IQueryable <T> > lazyQuery, Implementations?entityImplementations = null) { queries[queryName] = new DynamicQueryBucket(queryName, () => DynamicQueryCore.Auto(lazyQuery()), entityImplementations ?? DefaultImplementations(typeof(T), queryName)); }