public IQueryHandler <TResult> BuildSingleResultHandler <TResult>(IMartenSession session, Statement topStatement)
        {
            var selector = (ISelector <TResult>)SelectClause.BuildSelector(session);

            return(new OneResultHandler <TResult>(topStatement, selector, ReturnDefaultWhenEmpty, CanBeMultiples));
        }
        public IQueryHandler <TResult> BuildHandler <TResult>(IMartenSession session, Statement topStatement,
                                                              Statement currentStatement)
        {
            var selector = (ISelector <T>)Inner.BuildSelector(session);

            var handler = new ListWithStatsQueryHandler <T>(Inner.SelectFields().Length, topStatement, selector, _statistics);

            if (handler is IQueryHandler <TResult> h)
            {
                return(h);
            }

            throw new NotSupportedException("QueryStatistics queries are only supported for enumerable results");
        }
Exemple #3
0
 public JsonStatement(Type documentType, IFieldMapping fields, Statement parent) : base(typeof(DataSelectClause <>).CloseAndBuildAs <ISelectClause>(parent.ExportName,
                                                                                                                                                    documentType), fields)
 {
 }
        public IQueryHandler <TResult> BuildHandler <TResult>(IMartenSession session, Statement statement,
                                                              Statement currentStatement)
        {
            var selector = (ISelector <T>)BuildSelector(session);

            return(LinqHandlerBuilder.BuildHandler <T, TResult>(selector, statement));
        }