using Microsoft.EntityFrameworkCore;
using ProjeLibrary.Model;

namespace ProjeLibrary
{
    // entity framework kullanabilöek için
    // DBcontext isimli sınıftan miras alması gerekir
    public class ProjeDb : DbContext
    {
        private string _connectionstring= @"Data Source=DESKTOP-AEM4AS5\SQLEXPRESS;Initial Catalog=ef;Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;";
        public ProjeDb()
        {

        }

        public ProjeDb(string Connectionstring)
        {
            _connectionstring = Connectionstring;
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(_connectionstring);            
        }

        DbSet<User> Users { get; set; }
        DbSet<Product> Products { get; set; }
        DbSet<Category> Categories { get; set; }


    }
}
