ApplicationContext db sets

This commit is contained in:
Nikolai Papin 2024-09-07 11:46:57 +03:00
parent 22cd2f984e
commit dafcfab6a7

View File

@ -1,8 +1,21 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Renis.Database.Models;
namespace Renis.Database; namespace Renis.Database;
public class ApplicationContext : DbContext public class ApplicationContext : DbContext
{ {
public DbSet<User> Users { get; set; } = null!;
public DbSet<Polis> Polises { get; set; } = null!;
public DbSet<UserPolis> UserPolises { get; set; } = null!;
public DbSet<Car> Cars { get; set; } = null!;
public ApplicationContext(DbContextOptions<ApplicationContext> options) : base(options)
{
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
}
} }