Leitungen können nun bearbeitet werden

This commit is contained in:
HuskyTeufel
2021-09-28 10:46:16 +02:00
parent d9f34cbf90
commit e8674fed2c
43 changed files with 790 additions and 93 deletions

View File

@@ -8,28 +8,26 @@ using System.Threading.Tasks;
namespace DaSaSo.EntityFramework
{
public class DaSaSoDbContextFactory : IDesignTimeDbContextFactory<DaSaSoDbContext>
public class DaSaSoDbContextFactory
{
private readonly string _connectionString;
private readonly Action<DbContextOptionsBuilder> _configureDbContext;
public DaSaSoDbContextFactory()
public DaSaSoDbContextFactory(Action<DbContextOptionsBuilder> configureDbContext)
{
}
public DaSaSoDbContextFactory(string connectionString)
{
_connectionString = connectionString;
_configureDbContext = configureDbContext;
}
public DaSaSoDbContext CreateDbContext()
{
var options = new DbContextOptionsBuilder<DaSaSoDbContext>();
DbContextOptionsBuilder<DaSaSoDbContext>? options = new DbContextOptionsBuilder<DaSaSoDbContext>();
_configureDbContext(options);
//_connectionString = "Host = localhost; Database = dasaso; Username = kansan; Password = kansan";
options.UseNpgsql(_connectionString);
DaSaSoDbContext result = new DaSaSoDbContext(options.Options);
return result;
//options.UseNpgsql(_connectionString);
//DaSaSoDbContext result = new DaSaSoDbContext(options.Options);
return new DaSaSoDbContext(options.Options);
}
/*
public DaSaSoDbContext CreateDbContext(string[]? args = null)
{
var options = new DbContextOptionsBuilder<DaSaSoDbContext>();
@@ -37,5 +35,6 @@ namespace DaSaSo.EntityFramework
DaSaSoDbContext result = new DaSaSoDbContext(options.Options);
return result;
}
*/
}
}