Browse Source

Remove sync api from the startup template

pull/2464/head
Halil İbrahim Kalkan 6 years ago
parent
commit
9cabc686c8
  1. 40
      templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs

40
templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyProjectNameTestBase.cs

@ -17,26 +17,6 @@ namespace MyCompanyName.MyProjectName
options.UseAutofac();
}
protected virtual void WithUnitOfWork(Action action)
{
WithUnitOfWork(new AbpUnitOfWorkOptions(), action);
}
protected virtual void WithUnitOfWork(AbpUnitOfWorkOptions options, Action action)
{
using (var scope = ServiceProvider.CreateScope())
{
var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
using (var uow = uowManager.Begin(options))
{
action();
uow.Complete();
}
}
}
protected virtual Task WithUnitOfWorkAsync(Func<Task> func)
{
return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func);
@ -57,26 +37,6 @@ namespace MyCompanyName.MyProjectName
}
}
protected virtual TResult WithUnitOfWork<TResult>(Func<TResult> func)
{
return WithUnitOfWork(new AbpUnitOfWorkOptions(), func);
}
protected virtual TResult WithUnitOfWork<TResult>(AbpUnitOfWorkOptions options, Func<TResult> func)
{
using (var scope = ServiceProvider.CreateScope())
{
var uowManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>();
using (var uow = uowManager.Begin(options))
{
var result = func();
uow.Complete();
return result;
}
}
}
protected virtual Task<TResult> WithUnitOfWorkAsync<TResult>(Func<Task<TResult>> func)
{
return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func);

Loading…
Cancel
Save