MongoRepository documentation
MongoRepositoryT, TKey Class |
Deals with entities in MongoDb.
Inheritance Hierarchy
Namespace: MongoRepository
Assembly: MongoRepository.Net45 (in MongoRepository.Net45.dll) Version: 1.6.11.0 (1.6.11.0)
Syntax
public class MongoRepository<T, TKey> : IRepository<T, TKey>, IQueryable<T>, IEnumerable<T>, IQueryable, IEnumerable where T : Object, IEntity<TKey>
Public Class MongoRepository(Of T As {Object, IEntity(Of TKey)}, TKey) Implements IRepository(Of T, TKey), IQueryable(Of T), IEnumerable(Of T), IQueryable, IEnumerable
generic<typename T, typename TKey> where T : Object, IEntity<TKey> public ref class MongoRepository : IRepository<T, TKey>, IQueryable<T>, IEnumerable<T>, IQueryable, IEnumerable
type MongoRepository<'T, 'TKey when 'T : Object and IEntity<'TKey>> = class interface IRepository<'T, 'TKey> interface IQueryable<'T> interface IEnumerable<'T> interface IQueryable interface IEnumerable end
Type Parameters
- T
- The type contained in the repository.
- TKey
- The type used for the entity's Id.
The MongoRepositoryT, TKey type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MongoRepositoryT, TKey |
Initializes a new instance of the MongoRepository class.
Uses the Default App/Web.Config connectionstrings to fetch the connectionString and Database name.
| |
MongoRepositoryT, TKey(MongoUrl) |
Initializes a new instance of the MongoRepository class.
| |
MongoRepositoryT, TKey(String) |
Initializes a new instance of the MongoRepository class.
| |
MongoRepositoryT, TKey(MongoUrl, String) |
Initializes a new instance of the MongoRepository class.
| |
MongoRepositoryT, TKey(String, String) |
Initializes a new instance of the MongoRepository class.
|
Properties
Name | Description | |
---|---|---|
Collection |
Gets the Mongo collection (to perform advanced operations).
| |
CollectionName |
Gets the name of the collection
| |
ElementType |
Gets the type of the element(s) that are returned when the expression tree associated with this instance of IQueryable is executed.
| |
Expression |
Gets the expression tree that is associated with the instance of IQueryable.
| |
Provider |
Gets the query provider that is associated with this data source.
|
Methods
Name | Description | |
---|---|---|
Add(IEnumerableT) |
Adds the new entities in the repository.
| |
Add(T) |
Adds the new entity in the repository.
| |
Count |
Counts the total entities in the repository.
| |
Delete(ObjectId) |
Deletes an entity from the repository by its ObjectId.
| |
Delete(ExpressionFuncT, Boolean) |
Deletes the entities matching the predicate.
| |
Delete(T) |
Deletes the given entity.
| |
Delete(TKey) |
Deletes an entity from the repository by its id.
| |
DeleteAll |
Deletes all entities in the repository.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Exists |
Checks if the entity exists for given predicate.
| |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetById(ObjectId) |
Returns the T by its given id.
| |
GetById(TKey) |
Returns the T by its given id.
| |
GetEnumerator |
Returns an enumerator that iterates through a collection.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
RequestDone |
Lets the server know that this thread is done with a series of related operations.
| |
RequestStart |
Lets the server know that this thread is about to begin a series of related operations that must all occur
on the same connection. The return value of this method implements IDisposable and can be placed in a using
statement (in which case RequestDone will be called automatically when leaving the using statement).
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Update(IEnumerableT) |
Upserts the entities.
| |
Update(T) |
Upserts an entity.
|
Fields
Name | Description | |
---|---|---|
collection |
MongoCollection field.
|
See Also