efcore
efcore copied to clipboard
Database.BeginTransaction() fails after Database.EnsureCreatedAsync() called
Error message: begintransaction sqlexception: New transaction is not allowed because there are other threads running in the session
Can you confirm that you are waiting on the call to EnsureCreatedAsync() to complete before calling BeginTransaction()? You can't have two concurrent operations running on a single context instance, so you need to use await, Wait(), etc. to ensure the first call completes before starting a new operation.
If you are waiting for completion, can you share a complete code listing (or project) that we can use to reproduce the issue.
@rowanmiller No Wait() on the call. So it is not a bug.