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

namespace BookShelfMongoDB
{
    public class BookStoreContext
    {
        private IMongoDatabase _db { get; set; }
        private MongoClient _mongoClient { get; set; }
        public BookStoreContext()
        {
            _mongoClient = new MongoClient(ConfigurationManager.ConnectionStrings["BookStore"].ConnectionString);
            _db = _mongoClient.GetDatabase(ConfigurationManager.ConnectionStrings["BookStore"].Name);

        }
        public IMongoCollection<T> GetCollection<T>(string nameCollection)
        {
            return _db.GetCollection<T>(nameCollection);
        }
    }
}
