DbContext class separated.
This commit is contained in:
@ -5,28 +5,10 @@ namespace MessengerBroker.Db
|
||||
{
|
||||
public class BrokerDbContext : DbContext
|
||||
{
|
||||
private string connectionString;
|
||||
|
||||
public DbSet<Sync> Syncs { get; }
|
||||
|
||||
public DbSet<User> Users { get; }
|
||||
|
||||
public DbSet<Message> Messages { get; }
|
||||
|
||||
public BrokerDbContext(string connectionString)
|
||||
{
|
||||
this.connectionString = connectionString;
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
optionsBuilder.UseSqlServer(this.connectionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user