mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
32 lines
748 B
C#
32 lines
748 B
C#
using System.Threading.Tasks;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Kruzya.TelegramBot.Core.Data
|
|
{
|
|
public class CoreContext : DbContext
|
|
{
|
|
/// <summary>
|
|
/// The all known users.
|
|
/// </summary>
|
|
public DbSet<BotUser> Users { get; set; }
|
|
|
|
public DbSet<BotUserValue> UserValues { get; set; }
|
|
|
|
public override void Dispose()
|
|
{
|
|
SaveChanges();
|
|
base.Dispose();
|
|
}
|
|
|
|
public override ValueTask DisposeAsync()
|
|
{
|
|
SaveChanges();
|
|
return base.DisposeAsync();
|
|
}
|
|
|
|
public CoreContext(DbContextOptions<CoreContext> ctx) : base(ctx)
|
|
{
|
|
Database.Migrate();
|
|
}
|
|
}
|
|
} |