28 lines
917 B
C#
28 lines
917 B
C#
using BlogDatabase.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BlogDatabase
|
|
{
|
|
public class BlogDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=BlogSubd;Username=postgres;Password=postgres");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
}
|
|
public virtual DbSet<Role> Roles { set; get; }
|
|
public virtual DbSet<User> Users { set; get; }
|
|
public virtual DbSet<Topic> Topics { set; get; }
|
|
public virtual DbSet<Category> Categories { set; get; }
|
|
public virtual DbSet<Message> Messages { set; get; }
|
|
}
|
|
}
|