2020-06-06 23:18:41 +03:00
|
|
|
|
using Chatbot.Api.Domain.Data.EntityTypeConfiguration;
|
|
|
|
|
using Chatbot.Api.Domain.Entities;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2020-06-06 18:29:20 +03:00
|
|
|
|
|
|
|
|
|
namespace Chatbot.Api.Domain.Data.DbContexts
|
|
|
|
|
{
|
|
|
|
|
public class ChatDbContext : DbContext
|
|
|
|
|
{
|
2020-06-06 23:18:41 +03:00
|
|
|
|
public DbSet<Chat> Chats { get; set; }
|
|
|
|
|
|
2020-06-06 18:29:20 +03:00
|
|
|
|
public ChatDbContext(DbContextOptions<ChatDbContext> options)
|
|
|
|
|
: base(options)
|
|
|
|
|
{
|
|
|
|
|
base.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll;
|
|
|
|
|
base.ChangeTracker.AutoDetectChangesEnabled = true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-06 23:18:41 +03:00
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
base.OnModelCreating(modelBuilder);
|
2020-06-06 18:29:20 +03:00
|
|
|
|
|
2020-06-06 23:18:41 +03:00
|
|
|
|
modelBuilder.ApplyConfiguration(new ChatConfiguration());
|
|
|
|
|
}
|
2020-06-06 18:29:20 +03:00
|
|
|
|
}
|
|
|
|
|
}
|