You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In ef-core-migrations.md, there are some codes has runtime error!
After creating a MigrationsService and Worker.cs,just like:
privatestaticasyncTaskRunMigrationAsync(CommandDbContextdbContext,CancellationTokencancellationToken){varstrategy=dbContext.Database.CreateExecutionStrategy();awaitstrategy.ExecuteAsync(async()=>{// Run migration in a transaction to avoid partial migration if it fails.awaitusingvartransaction=awaitdbContext.Database.BeginTransactionAsync(cancellationToken);awaitdbContext.Database.MigrateAsync(cancellationToken);awaittransaction.CommitAsync(cancellationToken);});}
Afte running AspireHost, I got an error: User transaction is not supported with a TransactionSuppressed migrations or a retrying execution strategy.
So why use transaction?
The text was updated successfully, but these errors were encountered:
niltor
changed the title
Ef core migrations has build error codes, can't use transaction when migrations!
Ef core migrations has runtime errors, can't use transaction when migrations!
Nov 25, 2024
Describe the issue or suggestion
In ef-core-migrations.md, there are some codes has runtime error!
After creating a MigrationsService and
Worker.cs
,just like:Afte running AspireHost, I got an error:
User transaction is not supported with a TransactionSuppressed migrations or a retrying execution strategy.
So why use transaction?
The text was updated successfully, but these errors were encountered: