2020-11-10 21:44:20 +11:00

37 lines
1.1 KiB
C#

using Microsoft.EntityFrameworkCore;
namespace Infrastructure.Data
{
public class ExDbContext : DbContext
{
private string connectionString;
public ExDbContext()
{ }
public ExDbContext(DbContextOptions options) : base(options)
{ }
public ExDbContext(string connectionString)
{
this.connectionString = connectionString;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);
if (!string.IsNullOrWhiteSpace(connectionString))
{
optionsBuilder.UseSqlServer(connectionString);
}
//optionsBuilder.UseSqlServer("Server=tcp:kyljx9pxvr-dev.database.windows.net,1433;Database=oliverse_db_dev;User ID=olipos_admin@kyljx9pxvr-dev;Password=Mentor21;Trusted_Connection=False;Encrypt=True;Connection Timeout=150;");
}
}
}