elsa-core/samples/Sample14/ElsaContextFactory.cs
2019-07-26 19:10:43 +02:00

20 lines
700 B
C#

using Elsa.Persistence.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace Sample14
{
public class ElsaContextFactory : IDesignTimeDbContextFactory<ElsaContext>
{
public ElsaContext CreateDbContext(string[] args)
{
var optionsBuilder = new DbContextOptionsBuilder<ElsaContext>();
optionsBuilder.UseSqlite(
@"Data Source=c:\data\elsa.entity-framework-core.db;Cache=Shared",
x => x.MigrationsAssembly(typeof(Program).Assembly.FullName));
return new ElsaContext(optionsBuilder.Options);
}
}
}