17 lines
631 B
C#
17 lines
631 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Design;
|
|
|
|
namespace PLib.Infrastructure.Persistence;
|
|
|
|
/// <summary>
|
|
/// Used only by <c>dotnet ef</c> when it needs a context without running the application.
|
|
/// The connection string is irrelevant for generating migrations — nothing connects.
|
|
/// </summary>
|
|
public sealed class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<LibraryDbContext>
|
|
{
|
|
public LibraryDbContext CreateDbContext(string[] args) =>
|
|
new(new DbContextOptionsBuilder<LibraryDbContext>()
|
|
.UseSqlite("Data Source=design-time.db")
|
|
.Options);
|
|
}
|