Class MongoQueryProvider
An implementation of IQueryProvider for querying a MongoDB collection.
public class MongoQueryProvider : IQueryProvider
- Inheritance
-
MongoQueryProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
MongoQueryProvider(MongoCollection)
Initializes a new instance of the MongoQueryProvider class.
public MongoQueryProvider(MongoCollection collection)
Parameters
collection
MongoCollectionThe collection being queried.
Properties
Collection
Gets the Collection.
public MongoCollection Collection { get; }
Property Value
Methods
BuildMongoQuery<T>(MongoQueryable<T>)
Builds the MongoDB query that will be sent to the server when the LINQ query is executed.
public IMongoQuery BuildMongoQuery<T>(MongoQueryable<T> query)
Parameters
query
MongoQueryable<T>The LINQ query.
Returns
- IMongoQuery
The MongoDB query.
Type Parameters
T
The type of the documents being queried.
CreateQuery(Expression)
Creates a new instance MongoQueryable{{T}} for this provider. Calls the generic CreateQuery{{T}} to actually create the new MongoQueryable{{T}} instance.
public IQueryable CreateQuery(Expression expression)
Parameters
expression
ExpressionThe query expression.
Returns
- IQueryable
A new instance of MongoQueryable{{T}}.
CreateQuery<T>(Expression)
Creates a new instance of MongoQueryable{{T}} for this provider.
public IQueryable<T> CreateQuery<T>(Expression expression)
Parameters
expression
ExpressionThe query expression.
Returns
- IQueryable<T>
A new instance of MongoQueryable{{T}}.
Type Parameters
T
The type of the returned elements.
Execute(Expression)
Executes a query. Calls the generic method Execute{{T}} to actually execute the query.
public object Execute(Expression expression)
Parameters
expression
ExpressionThe query expression.
Returns
- object
The result of the query.
Execute<TResult>(Expression)
Executes a query.
public TResult Execute<TResult>(Expression expression)
Parameters
expression
ExpressionThe query expression.
Returns
- TResult
The result of the query.
Type Parameters
TResult
The type of the result.