Files
Kehyeedra/Kehyeedra3/ApplicationDbContextFactory.cs
Lan 6ae58b25b5 IM GONNA COOOOOD
AAAAAAAAAAAA I'M COODING AAAAAAAAAAAAAAAAAAAAAAAAAAAA
2020-02-16 22:10:11 +02:00

21 lines
624 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using System;
using System.Collections.Generic;
using System.Text;
namespace Kehyeedra3
{
class ApplicationDbContextFactory : IDesignTimeDbContextFactory<ApplicationDbContext>
{
public ApplicationDbContext CreateDbContext(string[] args = null)
{
var optionsBuilder = new DbContextOptionsBuilder<ApplicationDbContext>();
optionsBuilder.UseMySql(Environment.GetEnvironmentVariable("KEHYEEDRA_CONNSTR"));
return new ApplicationDbContext(optionsBuilder.Options);
}
}
}