Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "mikaelgra"

Hello, thank you for your answer.

I am worried this causes a bug in the framework. If I do this, then I get the following warning everytime UOW is used:

"Outer UOW key could not found in UnitOfWorkDictionary!"

I registered it like this:

IocManager.Register<IUnitOfWork, MySpecialUnitOfWork>( DependencyLifeStyle.Transient );

Any suggestions?

Hello. I also have this issue and would like a solution that doesn't simply just disable the transaction feature. Rather, it should disable to retry feature provided by the execution strategy of the DbContext in cases the transaction is not needed (which is the case for most 'get' methods).

I feel that this is definitely possible to implement, but it would require overriding the EfUnitOfWork from Abp.EntityFramework with my own class. Is this possible in ABP?

Something (roughly) like this would probably solve the issue:

public class MySpecialUnitOfWork : EfUnitOfWork
   {
      public MySpecialUnitOfWork ( IIocResolver iocResolver, IUnitOfWorkDefaultOptions defaultOptions )
         : base( iocResolver, defaultOptions )
      {

      }

      protected override void BeginUow()
      {
         if ( Options.IsTransactional == true )
         {
            MySpecialConfiguration.SuspendExecutionStrategy = true;
         }

         base.BeginUow();
      }

      protected override void CompleteUow()
      {
         base.CompleteUow();

         if ( CurrentTransaction != null )
         {
            MySpecialConfiguration.SuspendExecutionStrategy = false;
         }
      }

      protected async override Task CompleteUowAsync()
      {
         await base.CompleteUowAsync();

         if ( CurrentTransaction != null )
         {
            MySpecialConfiguration.SuspendExecutionStrategy = false;
         }
      }

      protected override void DisposeUow()
      {
         base.DisposeUow();

         if ( CurrentTransaction != null )
         {
            MySpecialConfiguration.SuspendExecutionStrategy = false;
         }
      }
   }

But how do I override the EfUnitOfWork registration with this?

Showing 1 to 2 of 2 entries