Hi @ismcagdas
No. I had to use workarounds.
@alper
Yes, that's a typo. It should be (and is) ITransientDependency
.
OK, interesting....
[UnitOfWork(IsDisabled = true)]
throws the original exceptionWhy would the IUnitOfWork not resolve for the BackgroundJob<TArgs>
base class? How do I go about fixing it?
Hi @alper
Thanks for the assistance. I have tried both ways, unsuccesfully unfortunately.
However, when I did this...
[UnitOfWork]
public override void Execute(TroubleshootingBackgroundJobArgs args)
{
using(var uow = UnitOfWorkManager.Begin()) // <== Exception generated here...
{
repository.GetAll().ToList();
uow.Complete();
}
}
.... I got the following exception:
Abp.AbpException HResult=0x80131500 Message=Must set UnitOfWorkManager before use it. Source=Abp StackTrace: at Abp.BackgroundJobs.BackgroundJob
1.get_UnitOfWorkManager() at Sanctions.SearchServices.Infrastructure.UnscConsolidatedSanctionList.Infrastructure.Persons.PersonMonitoringBatch.PersonMonitoringBatchSearchJob.ExecuteJob(PersonMonitoringBatchSearhJobArgs args) in D:\Projects\ZenDetect\Modules\Sanctions\Sanctions.SearchServices.Infrastructure.UnscConsolidatedSanctionList\Infrastructure\Persons\PersonMonitoringBatch\PersonMonitoringBatchSearchJob.cs:line 54 at Sanctions.SearchServices.Infrastructure.UnscConsolidatedSanctionList.Core.BatchSearchJobBase
1.Execute(TBatchSearhJobArgs args) in D:\Projects\ZenDetect\Modules\Sanctions\Sanctions.SearchServices.Infrastructure.UnscConsolidatedSanctionList\Core\BatchSearchJobBase.cs:line 20
Seems like the Unit of Work object is not resolving, for some reason?
@alper the issue persists
@ismcagdas I have done that. The error persists.
Guys, I am having serious issues with data access on backgroundjobs, both using EF and Dapper. See also https://support.aspnetzero.com/QA/Questions/7219
Can we please escalate this to get to a resolution? This is putting my project at serious risk. Please contact me via email to resolve it directly.
System.Data.SqlClient.SqlException HResult=0x80131904 Message=Invalid object name 'PersonRecord'. Source=Core .Net SqlClient Data Provider StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior) at Dapper.SqlMapper.ExecuteReaderWithFlagsFallback(IDbCommand cmd, Boolean wasClosed, CommandBehavior behavior) in C:\projects\dapper\Dapper\SqlMapper.cs:line 1064 at Dapper.SqlMapper.<QueryImpl>d__138
1.MoveNext() in C:\projects\dapper\Dapper\SqlMapper.cs:line 1081 at System.Collections.Generic.List1.AddEnumerable(IEnumerable
1 enumerable) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable
1 commandTimeout, Nullable1 commandType) in C:\projects\dapper\Dapper\SqlMapper.cs:line 723 at DapperExtensions.DapperImplementor.GetList[T](DbConnection connection, IClassMapper classMap, IPredicate predicate, IList
1 sort, DbTransaction transaction, Nullable1 commandTimeout, Boolean buffered) at DapperExtensions.DapperImplementor.GetList[T](DbConnection connection, Object predicate, IList
1 sort, DbTransaction transaction, Nullable1 commandTimeout, Boolean buffered) at DapperExtensions.DapperExtensions.GetList[T](DbConnection connection, Object predicate, IList
1 sort, DbTransaction transaction, Nullable1 commandTimeout, Boolean buffered) at Abp.Dapper.Repositories.DapperRepositoryBase
2.GetAll() at Castle.Proxies.Invocations.DapperRepositoryBase2_GetAll.InvokeMethodOnTarget() at Castle.DynamicProxy.AbstractInvocation.Proceed() at Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) at Castle.DynamicProxy.AbstractInvocation.Proceed() at Castle.Proxies.DapperEfRepositoryBase
3Proxy.GetAll() at MyModule.SearchServices.Infrastructure.UnscConsolidatedSanctionList.Infrastructure.Persons.PersonMonitoringBatch.PersonMonitoringBatchSearchJob.ExecuteJob(PersonMonitoringBatchSearhJobArgs args) in D:\Projects\MySystem\Modules\MyModule\MyModule.SearchServices.Infrastructure.UnscConsolidatedSanctionList\Infrastructure\Persons\PersonMonitoringBatch\PersonMonitoringBatchSearchJob.cs:line 91 at MyModule.SearchServices.Infrastructure.UnscConsolidatedSanctionList.Core.BatchSearchJobBase`1.Execute(TBatchSearhJobArgs args) in D:\Projects\MySystem\Modules\MyModule\MyModule.SearchServices.Infrastructure.UnscConsolidatedSanctionList\Core\BatchSearchJobBase.cs:line 20
Hi @ismcagdas
Yes, I have. I am still getting the same issue though.
@ismcagdas Any ideas?
@ismcagdas In general I would recommend that you split the default generated / main solution up into smaller modules. The main solution tends to grow quickly in terms of complexity and size, and upgrades become increasingly more difficult and unmanageable. Smaller modules means you could also do your releases for particular modules, meaning smaller, more manageable merges.
Good candidates for seperate modules:
@ryancyq @ismcagdas were you able to recreate the issue?