yet another question on DynamicQueryManager

Aug 6, 2013 at 10:15 AM
how can I use/excecute a "dqm" from code, rather than using a search control?
For example:
dqm.RegisterExpression((EmployeeDN u) => Database.Query<OrderDN>().Where(o => o.Employee == u), () => "OrdersByEmployee", "OrdersByEmployee");
I find this Column in SearchControl but I'm forced to rewrite the query in the business logic.
where am I doing wrong?
Aug 7, 2013 at 11:33 AM
Hi angabanga,

In your BusinessLogic class write a field like this:
    static Expression<Func<UserDN, IQueryable<UserTicketDN>>> TicketsExpression =
        u => Database.Query<UserTicketDN>().Where(ut => ut.User == u.ToLite());
    public static IQueryable<UserTicketDN> Tickets(this UserDN u)
        return TicketsExpression.Evaluate(u);
(snippet expressionMethodQuery)

Then on the Starter of this class:
  dqm.RegisterExpression((UserDN u) => u.Tickets());
Notice how now you can use the simple overload of RegisterExpression