Share the same transaction when enqueuing to implement Outbox Pattern?

Hi everyone.
I am trying to implement the Outbox Pattern where I need the Hangfire job enqueuing to share the same ongoing transaction used by the application to change and store business data, such that both jobs enqueuing and business data changes either succeed together or fail together as part of the same transaction. Background execution of the jobs will surely happen in another transaction.

Is this generally possible?
What if I use EF Core?

Regards,

Mohannad

1 Like