29 lines
779 B
C#
29 lines
779 B
C#
|
using MongoDB.Driver;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace SushiBarMongoDB
|
|||
|
{
|
|||
|
public class SushiBarMongoDB : IDisposable
|
|||
|
{
|
|||
|
private readonly MongoClient _client;
|
|||
|
private readonly IMongoDatabase _database;
|
|||
|
|
|||
|
public SushiBarMongoDB(string connectionString = "mongodb://localhost:27017", string databaseName = "lab8SUBD")
|
|||
|
{
|
|||
|
_client = new MongoClient(connectionString);
|
|||
|
_database = _client.GetDatabase(databaseName);
|
|||
|
}
|
|||
|
|
|||
|
public IMongoCollection<T> GetCollection<T>(string collectionName)
|
|||
|
{
|
|||
|
return _database.GetCollection<T>(collectionName);
|
|||
|
}
|
|||
|
|
|||
|
public void Dispose() { }
|
|||
|
}
|
|||
|
}
|