In Entity Framework 6, under the DbContext class you can get to current transaction by context.Database.CurrentTransaction. However this API doesn't seem like available in EF.Core. How can I retrieve current transaction object from a dbcontext in EF.Core?
EF Core still lacks many EF6 features, but (slowly) is catching up.
In that regard, I can't say for earlier versions, but in the latest (so far ) v1.1.0 the DbContext.Database
CurrentTransaction
property is there, so you can use the same code as in EF6 to access it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With