builder.AddSqlServerDbContext("sqldata");
< /code>
Когда я попробую это: < /p>
builder.Services.AddDbContextPool(options =>
{
var connectionString = builder.Configuration.GetConnectionString("sqldata") ?? throw new InvalidOperationException("Could not read SQL Server connection string");
options.UseSqlServer(connectionString);
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
});
builder.EnrichSqlServerDbContext();
< /code>
Я получаю ошибку ниже, когда пытаюсь генерировать миграции: < /p>
The exception 'Could not read SQL Server connection string' was thrown while attempting to find 'DbContext' types. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Я пытаюсь генерировать миграции EF в проекте .NET Aspire. Я следую примеру миграции в документации. < /P> Все работает хорошо с этим: < /p> [code]builder.AddSqlServerDbContext("sqldata"); < /code> Когда я попробую это: < /p> builder.Services.AddDbContextPool(options => { var connectionString = builder.Configuration.GetConnectionString("sqldata") ?? throw new InvalidOperationException("Could not read SQL Server connection string"); options.UseSqlServer(connectionString); options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); }); builder.EnrichSqlServerDbContext(); < /code> Я получаю ошибку ниже, когда пытаюсь генерировать миграции: < /p> The exception 'Could not read SQL Server connection string' was thrown while attempting to find 'DbContext' types. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728 [/code] Есть идеи о том, что я иду не так?