Class MongoDataStore<TData>
A IDataStore<TData> that uses MongoDB for storage.
Inheritance
Inherited Members
Namespace: Cqrs.Mongo.DataStores
Assembly: Cqrs.Mongo.dll
Syntax
public class MongoDataStore<TData> : IDataStore<TData>, IOrderedQueryable<TData>, IQueryable<TData>, IEnumerable<TData>, IOrderedQueryable, IQueryable, IEnumerable, IDisposable where TData : Entity
Type Parameters
Name | Description |
---|---|
TData | The System.Type of IEntity the IDataStore<TData> will contain. |
Constructors
MongoDataStore(ILogger, MongoCollection<TData>)
Instantiates and Initialises a new instance of the MongoDataStore<TData> class.
Declaration
public MongoDataStore(ILogger logger, MongoCollection<TData> mongoCollection)
Parameters
Type | Name | Description |
---|---|---|
cdmdotnet.Logging.ILogger | logger | |
MongoDB.Driver.MongoCollection<TData> | mongoCollection |
Properties
ElementType
Gets the type of the element(s) that are returned when the expression tree associated with this instance of System.Linq.IQueryable is executed.
Declaration
public Type ElementType { get; }
Property Value
Type | Description |
---|---|
System.Type | A System.Type that represents the type of the element(s) that are returned when the expression tree associated with this object is executed. |
Implements
Expression
Gets the expression tree that is associated with the instance of System.Linq.IQueryable.
Declaration
public Expression Expression { get; }
Property Value
Type | Description |
---|---|
System.Linq.Expressions.Expression | The System.Linq.Expressions.Expression that is associated with this instance of System.Linq.IQueryable. |
Implements
Logger
Gets or sets the cdmdotnet.Logging.ILogger
Declaration
protected ILogger Logger { get; }
Property Value
Type | Description |
---|---|
cdmdotnet.Logging.ILogger |
MongoCollection
Gets or sets the MongoCollection
Declaration
protected MongoCollection<TData> MongoCollection { get; }
Property Value
Type | Description |
---|---|
MongoDB.Driver.MongoCollection<TData> |
Provider
Gets the singleResultQuery provider that is associated with this data source.
Declaration
public IQueryProvider Provider { get; }
Property Value
Type | Description |
---|---|
System.Linq.IQueryProvider | The System.Linq.IQueryProvider that is associated with this data source. |
Implements
Methods
Add(TData)
Add the provided data
to the data store and persist the change.
Declaration
public virtual void Add(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Implements
Add(IEnumerable<TData>)
Add the provided data
to the data store and persist the change.
Declaration
public virtual void Add(IEnumerable<TData> data)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<TData> | data |
Implements
Destroy(TData)
Remove the provided data
(normally by Rsn) from the data store and persist the change.
Declaration
public void Destroy(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Implements
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public virtual void Dispose()
Implements
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<TData> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<TData> | A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection. |
Implements
Remove(TData)
Will mark the data
as logically (or soft) by setting IsLogicallyDeleted to true
Declaration
public virtual void Remove(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Implements
RemoveAll()
Remove all contents (normally by use of a truncate operation) from the data store and persist the change.
Declaration
public virtual void RemoveAll()
Implements
Repair()
Executes the "repairDatabase" command on the current database.
Declaration
public void Repair()
Update(TData)
Update the provided data
in the data store and persist the change.
Declaration
public virtual void Update(TData data)
Parameters
Type | Name | Description |
---|---|---|
TData | data |
Implements
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object that can be used to iterate through the collection. |