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
You must modify some of the RunMigrationAsync method content in the Worker.cs example code in the SupportTicketApi.MigrationService project.
privatestaticasyncTaskRunMigrationAsync(TicketContextdbContext,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);});}
Because ExecuteAsync manages transactions, an exception occurs when there is a custom (external) transaction.
Note
I have customised the User table by inheriting from IdentityUser.
System.NotSupportedException: User transaction is not supported with a TransactionSuppressed migrations or a retrying execution strategy.
A transaction was started before applying migrations. This prevents a database lock to be acquired and hence the database will not be protected from concurrent migration applications. The transactions and execution strategy are already managed by EF as needed. Remove the external transaction.
You must modify some of the
RunMigrationAsync
method content in theWorker.cs
example code in the SupportTicketApi.MigrationService project.Because
ExecuteAsync
manages transactions, an exception occurs when there is a custom (external) transaction.Note
I have customised the User table by inheriting from IdentityUser.
Therefore, it should be amended as follows
or
The text was updated successfully, but these errors were encountered: