17 lines
491 B
C#
17 lines
491 B
C#
using MongoDB.Driver;
|
|
|
|
namespace UGQDataAccess;
|
|
|
|
public class BaseRepository<TCollection> where TCollection : class
|
|
{
|
|
protected IMongoDatabase _mongoDatabase;
|
|
protected IMongoCollection<TCollection> Collection { get; }
|
|
|
|
protected BaseRepository(IMongoClient mongoClient, string databaseName, string collectionName)
|
|
{
|
|
_mongoDatabase = mongoClient.GetDatabase(databaseName);
|
|
|
|
this.Collection = _mongoDatabase.GetCollection<TCollection>(collectionName);
|
|
}
|
|
}
|