25 lines
611 B
C#
25 lines
611 B
C#
using Manager.Data.Entities.Cache;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Manager.Data.Contexts;
|
|
|
|
public sealed class CacheDbContext : DbContext
|
|
{
|
|
public CacheDbContext(DbContextOptions<CacheDbContext> options) : base(options)
|
|
{
|
|
Database.EnsureCreated();
|
|
}
|
|
|
|
public DbSet<CacheEntity> Cache { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<CacheEntity>(ce =>
|
|
{
|
|
ce.ToTable("cache");
|
|
ce.HasKey(x => x.Id);
|
|
});
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
}
|
|
} |