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

27 lines
844 B
C#

using Chatbot.Api.Domain.Data.EntityTypeConfiguration;
using Chatbot.Api.Domain.Entities;
using Microsoft.EntityFrameworkCore;
namespace Chatbot.Api.Domain.Data.DbContexts
{
public class ChatDbContext : DbContext
{
public DbSet<Chat> Chats { get; set; }
public ChatDbContext(DbContextOptions<ChatDbContext> options)
: base(options)
{
base.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll;
base.ChangeTracker.AutoDetectChangesEnabled = true;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(new ChatConfiguration());
modelBuilder.ApplyConfiguration(new ChatMessageConfiguration());
}
}
}