コード例 #1
0
ファイル: PowerTablesHandler.cs プロジェクト: andrei-mmn/PT
        private PowerTablesData ProduceData(IQueryable <TSourceData> source, PowerTableRequest request)
        {
            try
            {
                //gather data
                var  filtered = _queryHandler.ApplyFiltering(source, request.Query);
                var  ordered  = _queryHandler.ApplyOrdering(filtered, request.Query);
                long count    = 0;
                int  page     = 0;


                var paged        = _queryHandler.ApplyPaging(ordered, request.Query, out count, out page);
                var mapped       = new Lazy <TTableData[]>(() => _queryHandler.ApplyMapping(paged, request.Query));
                var mappedObject =
                    new Lazy <object[]>(() => _queryHandler.ApplyMapping(paged, request.Query).Cast <object>().ToArray());

                var data = new PowerTablesData(source, filtered, ordered, paged, mappedObject, _configuration, request,
                                               count,
                                               page);
                data._OriginalLazy = mapped;
                return(data);
            }
            catch (InvalidOperationException ex)
            {
                throw new Exception(
                          String.Format(@"InvalidOperationException thrown.
We recommend to re-check filters configuration against filtering/mapping on nullable columns. 
Lattice does not throw InvalidOperationException itself, but we not always handle filtering of nullable columns 
because it is highly dependent on query provider.
Consider usage of null-coalescing operator (??) within your nullables.
Btw, original message was: {0}", ex.Message),
                          ex);
            }
        }