Beispiel #1
0
        public void TestSerializeSortByWrapped()
        {
            var c = new C {
                X = 1
            };
            var w        = SortByWrapper.Create(c);
            var json     = w.ToJson();
            var expected = "{ 'X' : 1 }".Replace("'", "\"");

            Assert.Equal(expected, json);
        }
Beispiel #2
0
 /// <summary>
 /// Finds the specified spec.
 /// </summary>
 /// <param name="spec">The spec.</param>
 /// <param name="orderby">The orderby.</param>
 /// <param name="limit">The limit.</param>
 /// <param name="skip">The skip.</param>
 /// <returns></returns>
 public IEnumerable <TEntity> Find(object spec, object orderby, int limit, int skip)
 {
     using (_mongoHelper.Repository.RequestStart())
     {
         return(_mongoHelper.Repository.GetCollection <TEntity>(_collection).Find(QueryWrapper.Create(spec))
                .SetSortOrder(SortByWrapper.Create(orderby))
                .SetSkip(skip)
                .SetLimit(limit)
                .ToList());
     }
 }