29 lines
854 B
C#
29 lines
854 B
C#
using DatabaseImplement.models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Runtime.ConstrainedExecution;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DatabaseImplement
|
|
{
|
|
public class AppDataBase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseNpgsql("Server=PostgreSQL;Host=localhost;Port=5432;Database=ClientsAndProducts;Username=postgres;Password=123456");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
|
|
public virtual DbSet<Client> Clients { set; get; }
|
|
|
|
public virtual DbSet<Product> Products { set; get; }
|
|
}
|
|
}
|