Class MongoContext
Mongo context
Inheritance
System.Object
MongoContext
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Simplic.Data.MongoDB
Assembly: Simplic.Data.MongoDB.dll
Syntax
public class MongoContext : IMongoContext, IDatabaseContext, IDisposable
Constructors
| Improve this Doc View SourceMongoContext(IConnectionConfigurationService)
Declaration
public MongoContext(IConnectionConfigurationService configurationService)
Parameters
Type | Name | Description |
---|---|---|
IConnectionConfigurationService | configurationService |
Properties
| Improve this Doc View SourceEnableTransactions
Gets or sets whether transactions are allowed or not
Declaration
public bool EnableTransactions { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
MongoClient
Gets the mongo client instance
Declaration
public MongoClient MongoClient { get; }
Property Value
Type | Description |
---|---|
MongoClient |
Session
Gets or sets the client session handle
Declaration
public IClientSessionHandle Session { get; set; }
Property Value
Type | Description |
---|---|
IClientSessionHandle |
Methods
| Improve this Doc View SourceAddCommand(Func<Task>)
Declaration
public void AddCommand(Func<Task> func)
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.Threading.Tasks.Task> | func |
Dispose()
Dispose context
Declaration
public void Dispose()
GetCollection<T>(String)
Get mongodb collection
Declaration
public IMongoCollection<T> GetCollection<T>(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Collection name |
Returns
Type | Description |
---|---|
IMongoCollection<T> | Collection instance |
Type Parameters
Name | Description |
---|---|
T | Entity type |
SaveChangesAsync()
Declaration
public async Task<int> SaveChangesAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> |
SetConfiguration(String)
Set database configuration by name
Declaration
public void SetConfiguration(string configurationName)
Parameters
Type | Name | Description |
---|---|---|
System.String | configurationName |
Implements
System.IDisposable