Transaction Per Request Middleware Not working
问题 I am trying to add a middleware so that transaction begins at the beginning of the request and commits or rollbacks depending on the situation. This is my middleware: public class TransactionPerRequestMiddleware { private readonly RequestDelegate next_; public TransactionPerRequestMiddleware(RequestDelegate next) { next_ = next; } public async Task Invoke(HttpContext context, AppDbContext dbContext) { var is_everything_ok = true; var transaction = dbContext.Database.BeginTransaction( System