/// <summary> /// Creates a <see cref="CosmosDbQuery{T}"/> to enable LINQ-style queries. /// </summary> /// <typeparam name="T">The entity <see cref="Type"/>.</typeparam> /// <param name="queryArgs">The <see cref="CosmosDbArgs"/>.</param> /// <param name="query">The function to perform additional query execution.</param> /// <returns>The <see cref="CosmosDbQuery{T}"/>.</returns> public CosmosDbQuery <T> Query <T>(CosmosDbArgs queryArgs, Func <IOrderedQueryable <T>, IQueryable <T> > query = null) where T : class, IIdentifier, new() { return(new CosmosDbQuery <T>(this, queryArgs, query)); }
/// <summary> /// Initializes a new instance of the <see cref="CosmosDbContainer{T, TModel}"/> class. /// </summary> /// <param name="cosmosDb">The <see cref="CosmosDb"/>.</param> /// <param name="dbArgs">The <see cref="CosmosDbArgs{T, TModel}"/>.</param> public CosmosDbContainer(CosmosDbBase cosmosDb, CosmosDbArgs <T, TModel> dbArgs) { CosmosDb = cosmosDb ?? throw new ArgumentNullException(nameof(cosmosDb)); DbArgs = dbArgs ?? throw new ArgumentNullException(nameof(dbArgs)); Container = cosmosDb.CosmosContainer(DbArgs.ContainerId); }
/// <summary> /// Initializes a new instance of the <see cref="CosmosDbQuery{T}"/> class. /// </summary> /// <param name="db">The <see cref="CosmosDbBase"/>.</param> /// <param name="queryArgs">The <see cref="CosmosDbArgs"/>.</param> /// <param name="query">A function to modify the underlying <see cref="IQueryable{T}"/>.</param> internal CosmosDbQuery(CosmosDbBase db, CosmosDbArgs queryArgs, Func <IOrderedQueryable <T>, IQueryable <T> > query = null) { _db = Check.NotNull(db, nameof(db)); QueryArgs = Check.NotNull(queryArgs, nameof(queryArgs)); _query = query; }