model and Dto
This commit is contained in:
36
Infrastructure/Persistence/HushianDbContext.cs
Normal file
36
Infrastructure/Persistence/HushianDbContext.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user