Base solution for your next web application
Open Closed

UnitOfwork in PostInitialize #1980


User avatar
0
tiny created
public override void PostInitialize()
        { 
            var uowManager = IocManager.Resolve<IUnitOfWorkManager>();
            using (uowManager.Begin())
            {
                using (var taskAppServices = IocManager.ResolveAsDisposable<ReportTasks.ReportTaskAppService>())
                {
                    taskAppServices.Object.RestoreAllTask();
                }
            }
        }
public void RestoreAllTask()
      {
            var tasks = _reportTaskRepository.GetAllList().MapTo<List<ReportTaskEditDto>>();

            foreach (var task in tasks)
            {
                //todo
            }
     }

Is there better way change my code? I dont want IocManager.Resolve<IUnitOfWorkManager>() here , but [UnitOfWork] not work


1 Answer(s)