Straws
Straws
CC#
Created by Straws on 3/7/2025 in #help
Unable to create new Postgres Database with Ef Core
It looks like when it pull the connection string the password is truncated :/ I have no clue why its doing that
5 replies
CC#
Created by Straws on 3/7/2025 in #help
Unable to create new Postgres Database with Ef Core
public static WebApplicationBuilder AddDatabaseConnections(this WebApplicationBuilder builder)
{
ArgumentNullException.ThrowIfNull(builder);

var connectionString = builder.Configuration.GetConnectionString("mydb");
Console.WriteLine(connectionString);
ArgumentException.ThrowIfNullOrEmpty(connectionString);

builder.Services.AddDbContext<MyDbContext>(opt =>
{
opt.UseNpgsql(connectionString);
});

return builder;
}
public static WebApplicationBuilder AddDatabaseConnections(this WebApplicationBuilder builder)
{
ArgumentNullException.ThrowIfNull(builder);

var connectionString = builder.Configuration.GetConnectionString("mydb");
Console.WriteLine(connectionString);
ArgumentException.ThrowIfNullOrEmpty(connectionString);

builder.Services.AddDbContext<MyDbContext>(opt =>
{
opt.UseNpgsql(connectionString);
});

return builder;
}
5 replies