PIAPS_CW/DatabaseImplement/Database.cs
2024-06-22 12:18:43 +04:00

31 lines
1.0 KiB
C#

using DatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DatabaseImplement
{
public class Database : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseNpgsql("Server=192.168.191.42:32768;Database=gun_market;Username=postgres;Password=7355608;");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Role> Roles { get; set; } = null!;
public virtual DbSet<User> Users { get; set; } = null!;
public virtual DbSet<Sell> Sells { get; set; } = null!;
public virtual DbSet<Purchase> Purchases { get; set; } = null!;
public virtual DbSet<Product> Products { get; set; } = null!;
public virtual DbSet<Supply> Supplies { get; set; } = null!;
public virtual DbSet<SupplyProduct> SupplyProducts { get; set; } = null!;
public virtual DbSet<MediaFile> MediaFiles { get; set; } = null!;
}
}