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
}
}
Hi, is there other best way to do?
if i dont want IocManager.Resolve<IUnitOfWorkManager>() here.
[UnitOfWork] not work for PostInitialize.
1 Answer(s)
-
0
Hi,
Instead of doing this, you can create a background job and start it in the PostInitialize of your module. See <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Background-Jobs-And-Workers">http://aspnetboilerplate.com/Pages/Docu ... nd-Workers</a>.
You can use UnitOfWork attribute in your backgroundJob. In this way, you dont block the initialization of your application.
Have an answer to this question?
Log in
and write your answer.