using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BookStore
{
    public class BookStoreContext
    {
        private IMongoDatabase _db { get; set; }
        private MongoClient _mongoClient { get; set; }
        public BookStoreContext()
        {
            _mongoClient = new MongoClient(ConfigurationManager.ConnectionStrings["MongoDb"].ConnectionString);
            _db = _mongoClient.GetDatabase(ConfigurationManager.ConnectionStrings["MongoDb"].Name);
        }
        public IMongoCollection<T> GetCollection<T>(string nameCollection)
        {
            return _db.GetCollection<T>(nameCollection);
        }
    }
}
