Skip to content

Commit 86641ca

Browse files
committed
Kontroller generátor workaround
1 parent 27678e7 commit 86641ca

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

WebApiLab.DAL/AppDbContext.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.EntityFrameworkCore;
2+
using Microsoft.EntityFrameworkCore.Design;
23
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
34
using Microsoft.Extensions.Logging;
45

@@ -85,3 +86,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
8586
public DbSet<Category> Categories => Set<Category>();
8687
public DbSet<Order> Orders => Set<Order>();
8788
}
89+
90+
91+
//Csak a kontroller generálás idejére kommentezd vissza! Ne maradjon a kódban véglegesen.
92+
//DbContextOptions<>-t váró DbContext konstruktor szükséges!
93+
//Megkerülő megoldás ehhez: https://github.com/dotnet/Scaffolding/issues/1765
94+
//public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
95+
//{
96+
// public AppDbContext CreateDbContext(string[] args)
97+
// {
98+
// var builder = new DbContextOptionsBuilder<AppDbContext>();
99+
// builder.UseSqlServer("dummy");
100+
// return new AppDbContext(builder.Options);
101+
// }
102+
//}

0 commit comments

Comments
 (0)