2023-05-18 21:34:36 +04:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.ComponentModel;
|
2023-09-06 21:16:28 +04:00
|
|
|
|
using BlogDatabase.Models;
|
2023-05-18 21:34:36 +04:00
|
|
|
|
|
|
|
|
|
namespace BlogDatabaseImplement
|
|
|
|
|
{
|
|
|
|
|
public class BlogDatabase : DbContext
|
|
|
|
|
{
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
|
|
|
|
if (optionsBuilder.IsConfigured == false)
|
|
|
|
|
{
|
2023-09-06 21:16:28 +04:00
|
|
|
|
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=ForumSubd;Username=postgres;Password=postgres");
|
2023-05-18 21:34:36 +04:00
|
|
|
|
}
|
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
|
|
|
|
}
|
2023-09-06 21:16:28 +04:00
|
|
|
|
public virtual DbSet<Role> Roles { set; get; }
|
2023-05-18 21:34:36 +04:00
|
|
|
|
public virtual DbSet<User> Users { set; get; }
|
2023-09-06 21:16:28 +04:00
|
|
|
|
public virtual DbSet<Topic> Topics { set; get; }
|
|
|
|
|
public virtual DbSet<Category> Categories { set; get; }
|
|
|
|
|
public virtual DbSet<Message> Messages { set; get; }
|
2023-05-18 21:34:36 +04:00
|
|
|
|
}
|
|
|
|
|
}
|