chatbot/Chatbot.Api.Domain.Data/DbContexts/SessionDbContext.cs

26 lines
794 B
C#
Raw Normal View History

2020-06-06 19:21:40 +03:00
using Chatbot.Api.Domain.Data.EntityTypeConfiguration;
using Chatbot.Api.Domain.Entities;
using Microsoft.EntityFrameworkCore;
namespace Chatbot.Api.Domain.Data.DbContexts
{
public class SessionDbContext : DbContext
{
public DbSet<BotSession> BotSessions { get; set; }
public SessionDbContext(DbContextOptions<SessionDbContext> options)
: base(options)
{
base.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll;
base.ChangeTracker.AutoDetectChangesEnabled = true;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(new BotSessionConfiguration());
}
}
}