First commit that builds.
This commit is contained in:
32
code/MessengerBroker.Db/BrokerDbContext.cs
Normal file
32
code/MessengerBroker.Db/BrokerDbContext.cs
Normal file
@ -0,0 +1,32 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user