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

26 lines
761 B
C#

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