public virtual ValueBuffer Create(BsonDocument recordData, IValueBufferFromBsonShaper valueBufferShaper) /* object*/
        {
            var fieldCount = recordData.Count;

            if (fieldCount == 0)
            {
                return(ValueBuffer.Empty);
            }

            var values = new object[fieldCount];

            _processValuesAction?.Invoke(values);

            for (var i = 0; i < fieldCount; i++)
            {
                values[i] = recordData.Values.ToList()[i];
            }

            var idx = 0;

            foreach (var bsonElement in recordData)
            {
                values[idx] = bsonElement;
                idx++;
            }

            return(valueBufferShaper.Shape(new ValueBuffer(values)));
        }
Example #2
0
 public QueryingEnumerable(
     LiteDBQueryContext queryContext,
     ShaperCommandContext shaperCommandContext,
     IValueBufferFromBsonShaper valueBufferShaper)
 {
     _queryContext         = queryContext;
     _shaperCommandContext = shaperCommandContext;
     _valueBufferShaper    = valueBufferShaper;
 }
Example #3
0
 private static IEnumerable <T> _ShapedQuery <T>(
     QueryContext queryContext,
     ShaperCommandContext shaperCommandContext,
     IShaper <T> shaper,
     IValueBufferFromBsonShaper valueBufferShaper)
 {
     foreach (var valueBuffer in new QueryingEnumerable((LiteDBQueryContext)queryContext, shaperCommandContext, valueBufferShaper))
     {
         yield return(shaper.Shape(queryContext, valueBuffer));
     }
 }
Example #4
0
        public QueryingEnumerable(
            [NotNull] MongoDbQueryContext queryContext,
            [NotNull] ShaperCommandContext shaperCommandContext,
            [NotNull] IValueBufferFromBsonShaper valueBufferShaper)
        {
            Check.NotNull(queryContext, nameof(queryContext));
            Check.NotNull(shaperCommandContext, nameof(shaperCommandContext));
            Check.NotNull(valueBufferShaper, nameof(valueBufferShaper));

            _queryContext         = queryContext;
            _shaperCommandContext = shaperCommandContext;
            _valueBufferShaper    = valueBufferShaper;
        }