Open Closed

UnitOfWork on Background job #3194


0
barrett2474 created

Greetings,

I have a background job that when it executes, I wish to do a number of database calls. It's important that they are wrapped in a single transaction (UnitOfWork).

Question Will using the Attribute "UnitOfWork" on the said AsyncBackgroundJob be the best way?

  [UnitOfWork(isTransactional: true)]
  public override async Task ExecuteAsync(SaveTransactionFileUploadDto args)

Thanks you for your time,

Regards John

  • ABP Framework version: v5.2.2
  • UI type: Blazor WASM
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no

1 Answer(s)
  • 1
    maliming created
    Support Team

    hi

    yes, and you can also begin a uow manually.

    https://docs.abp.io/en/abp/latest/Unit-Of-Work#begin-a-new-unit-of-work