37 lines
1.0 KiB
C#
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);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|