Open Closed

[UnitOfWork(isTransactional: false)] #33


0
mohamed emaish created

if my application service method modify one record only is it save to use [UnitOfWork(isTransactional: false)] or should i use it only with read operations ?


1 Answer(s)
  • 0
    hikalkan created

    I advice to not disable transaction unless it is really needed.

    • For single save operation, don't disable it since it does not matter. Single save is transactional itself and has no affect. But what if your code may throw exception after save? Should it rollback the save? If no, you can disable transaction. This may be the only reason.

    • For all reads don't disable it unless your code reads a lot of data and a long transaction can be problem. Otherwise, for simple readings do not change it.