Files
Hushian/Infrastructure/Persistence/HushianDbContext.cs
2025-06-28 15:31:07 +03:30

37 lines
1.0 KiB
C#

using Hushian.Domain.Entites;
using Microsoft.EntityFrameworkCore;
namespace Hushian.Persistence
{
public class HushianDbContext : DbContext
{
public HushianDbContext(DbContextOptions<HushianDbContext> options)
:base(options)
{
}
#region Table
public DbSet<Company> Companies { get; set; }
public DbSet<Conversation> Conversations { get; set; }
public DbSet<ConversationItem> ConversationItems { get; set; }
public DbSet<Group> Groups { get; set; }
public DbSet<Exper> Expers { get; set; }
public DbSet<ExperGroup> EG { get; set; }
public DbSet<User> Users { get; set; }
#endregion
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ExperGroup>().HasKey(c => new { c.ExperID, c.GroupID });
modelBuilder
.ApplyConfigurationsFromAssembly(typeof(HushianDbContext).Assembly);
}
}
}