using MongoDB.Driver;
using System.Configuration;

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);
        }
    }
}
