/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="projection"></param> /// <param name="sortExp"></param> /// <param name="sortType"></param> /// <param name="limit"></param> /// <param name="skip"></param> /// <param name="hint"></param> /// <returns></returns> public FindOptions <T, T> CreateFindOptions <T>(ProjectionDefinition <T, T> projection = null, Expression <Func <T, object> > sortExp = null, SortType sortType = SortType.Ascending, int limit = 0, int skip = 0, BsonValue hint = null) { FindOptions <T, T> findOptions = new FindOptions <T, T>(); if (limit > 0) { findOptions.Limit = new int?(limit); } if (skip > 0) { findOptions.Skip = new int?(skip); } if (projection != null) { findOptions.Projection = projection; } SortDefinition <T> sortDefinition = this.CreateSortDefinition <T>(sortExp, sortType); if (sortDefinition != null) { findOptions.Sort = sortDefinition; } if (hint != null) { FindOptionsBase arg_67_0 = findOptions; BsonDocument bsonDocument = new BsonDocument(); bsonDocument.Add("$hint", hint); arg_67_0.Modifiers = bsonDocument; } return(findOptions); }
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="projection"></param> /// <param name="sort"></param> /// <param name="limit"></param> /// <param name="skip"></param> /// <param name="hint"></param> /// <returns></returns> public FindOptions <T, T> CreateFindOptions <T>(ProjectionDefinition <T, T> projection = null, SortDefinition <T> sort = null, int limit = 0, int skip = 0, BsonValue hint = null) { FindOptions <T, T> findOptions = new FindOptions <T, T>(); if (limit > 0) { findOptions.Limit = new int?(limit); } if (skip > 0) { findOptions.Skip = new int?(skip); } if (projection != null) { findOptions.Projection = projection; } if (sort != null) { findOptions.Sort = sort; } if (hint != null) { FindOptionsBase arg_5C_0 = findOptions; BsonDocument bsonDocument = new BsonDocument(); bsonDocument.Add("$hint", hint); arg_5C_0.Modifiers = bsonDocument; } return(findOptions); }
/// <summary> /// Applies the options to the executable /// </summary> /// <param name="options">The options</param> /// <returns>A executable that contains the options</returns> public IMongoDbExecutable WithOptions(FindOptionsBase options) { Options = options; return(this); }