33 lines
833 B
C#
33 lines
833 B
C#
using MessengerBroker.Db.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|