/// <summary> /// Removes the specified id. /// </summary> /// <param name="id">The id.</param> public void Remove(TId id) { _mongoHelper.Repository.GetCollection <TEntity>(_collection) .FindAndRemove(QueryWrapper.Create(new { _id = id }), SortBy.Null); }
/// <summary> /// Removes the specified spec. /// </summary> /// <param name="spec">The spec.</param> public void Remove(object spec) { _mongoHelper.Repository.GetCollection <TEntity>(_collection).Remove(QueryWrapper.Create(spec)); }
/// <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()); } }
/// <summary> /// Finds the count. /// </summary> /// <param name="spec">The spec.</param> /// <returns></returns> public long Count(object spec) { return(_mongoHelper.Repository.GetCollection <TEntity>(_collection).Count(QueryWrapper.Create(spec))); }
/// <summary> /// Finds the specified spec. /// </summary> /// <param name="spec">The spec.</param> /// <returns></returns> public IEnumerable <TEntity> Find(object spec) { using (_mongoHelper.Repository.RequestStart()) { return(_mongoHelper.Repository.GetCollection <TEntity>(_collection).Find(QueryWrapper.Create(spec)).ToList()); } }
/// <summary> /// Finds the one. /// </summary> /// <param name="spec">The spec.</param> /// <returns></returns> public TEntity FindOne(object spec) { using (_mongoHelper.Repository.RequestStart()) { return(_mongoHelper.Repository.GetCollection <TEntity>(_collection).FindOne(QueryWrapper.Create(spec))); } }