초기커밋
This commit is contained in:
16
UGQDataAccess/BaseRepository.cs
Normal file
16
UGQDataAccess/BaseRepository.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user