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); } }
/// <summary> /// Applies response modifiers. An implementation for IResponseModifiersApplier. Should not be used directly /// </summary> /// <param name="data">Selected and prepared data</param> /// <param name="response">Existing response</param> void IResponseModifiersApplier.ApplyResponseModifiers(PowerTablesData data, PowerTablesResponse response) { foreach (var responseModifier in _configuration.ResponseModifiers) { responseModifier.ModifyResponse(data, response); } }