Attività di "RonaldR"

I suspected it had to do with unit of work, but we arent tagging these functions as [UnitOfWork]. it is implicit in v4?

so in the functions i want to make sure are outside the scope of their clling fucntions i need to wrap them in their own unit of work?

thanks

More information: i can repeat it fairly regularly when i am running multiple jobs simultaneously from hangfire.

hope that helps

Here is the whole error stack trace

" at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.Enumerator.Dispose()\r\n at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source)\r\n at Castle.Proxies.Invocations.ITenantRepository_FindById.InvokeMethodOnTarget()\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Castle.DynamicProxy.AbstractInvocation.ProceedInfo.Invoke()\r\n at Castle.DynamicProxy.AsyncInterceptorBase.ProceedSynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.<ProceedAsync>d__7.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Volo.Abp.Uow.UnitOfWorkInterceptor.<InterceptAsync>d__3.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.<InterceptAsync>d__31.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at Castle.DynamicProxy.NoCoverage.RethrowHelper.Rethrow(Exception exception)\r\n at Castle.DynamicProxy.NoCoverage.RethrowHelper.RethrowInnerIfAggregate(Exception exception)\r\n at Castle.DynamicProxy.AsyncInterceptorBase.InterceptSynchronousResult[TResult](AsyncInterceptorBase me, IInvocation invocation)\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Castle.Proxies.IBasicRepository1Proxy_12.FindById(Guid id, Boolean includeDetails)\r\n at Volo.Saas.Tenants.TenantStore.Find(Guid id)\r\n at Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver.Resolve(String connectionStringName)\r\n at DAG.TFORM.Web.Resolvers.TFORMMultiTenantConnectionStringResolver.Resolve(String connectionStringName) in C:\Users\ronald.rizk\source\repos\tform_repo\DAG.TFORM\aspnet-core\src\DAG.TFORM.Web\Resolvers\TFORMMultiTenantConnectionStringResolver.cs:line 27"

That line 27 is the line of code i identified above: var connectionString = base.Resolve(connectionStringName);

public async Task LinuxNetstatsDiscovery(string TaskName, Guid? TenantId)
{

	DateTime nowDt = DateTime.UtcNow;
	List<string> failedIpAddesses = new List<string>();

	using (CurrentTenant.Change(TenantId))
	{
		var sourceOfTruthNewDevices = new List<SourceOfTruthDataModel>();
**This class function is defined below	**	
		Guid BgjID = await _helperRepository.CreateBackgroundJobProcessingRecord(TenantId, $"{OperatingSystemEnum.Names.Linux} {DiscoveryType} Discovery");
		List<HostListItemModel> hosts = await _helperRepository.GetHostList(TenantId, OperatingSystemEnum.OperatingSystem.Linux);

		try
		{
			foreach (var host in hosts)
			{
				... do our processing ...
				add record to DbContenxt.MyTable(record);
			}

			await _helperRepository.UpdateBackgroundJobStatusSuccess(BgjID, failedIpAddesses);
			await DbContext.SaveChangesAsync();
		}
		catch (Exception ex)
		{
			//DbContext.Reset();
			LogException(ex);
			await _helperRepository.UpdateBackgroundJobStatusError(BgjID, failedIpAddesses);
			throw;
		}
	}
}

public async Task<Guid> CreateBackgroundJobProcessingRecord(Guid? tenantId, string jobName)
{
	BackgroundJobDataModel jobDetails = new BackgroundJobDataModel(_guidGenerator.Create())
	{
		StartTime = DateTime.UtcNow,
		TenantId = tenantId,
		JobName = jobName,

		Status = "Processing"
	};

	jobDetails.EndTime = jobDetails.StartTime;

**_backgroundRepository is an IRepositry that is dependancy injected in the consturctor**
	await _backgroundRepository.InsertAsync(jobDetails, true);
	await _backgroundRepository.GetDbContext().SaveChangesAsync();

	return jobDetails.Id;
}

so even though i save changes in this function, it does not unless i hit the save changes at the bottom of my loop

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v4.1.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:
  • So the problem we are habing is we are invoking jobs through hangfire. i am assuming this problem exists everywhere but i know how to recreate it here.
  • In the function we do a lot of database work. we create a job with an id, then give that id to every record processed, then when we are done we update the dtatus of the job.
  • if there is an exception we log it and report the job failed.
  • what we have found is that if it hits the exception, no data is saved. this is partially the expected behavior.
  • When the function to create the job orlog an exception is called, we use an irepositoy, and we call save changes in those functions so that data should be saved.
  • we do not call the save changes at the end of our look unless it is successful.
  • what we find though is if it fails and we do not save changes in the main function and we exit out, none of the data saves, including the job, which we did call save changes after
  • we are not identifying this as unitofwork, andi looked at the backgroundjob interface and did not see execute as unitof work.
  • why would we be getting htis behavior? should anything done prior to the save changes be saved?

i have no way to create the issue on demand, it just sort of happens some times, here is a screenshot of the code along with the error. not that it should matter, but the connectionStringName is not null, but null should be a valid option for it

https://gyazo.com/e1c07cce38a2e189cef5e7c4e4445639

Domanda

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v3.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:
  • Is there a best practice for building a ui for the db migraor? the initial time we run it there are questions we would like to ask to properly initialize the data with a user and tenant.
  • Also, is there a way that i can invoce the migrator, or parts of it, programaticaly? when a new tenant is added we need to run it in the database to setup menuing ans security for the new tenant, or we need to run it to create the new tenant database. so what we are trying to do is if a new tenant is created, we want to be able to fire off that functionality. is there a best practice for this?

i already do that, if the string being returned from the Base.resolver is empty i just return string.empty. should it be null instead? that being said, thats not the line that fails, i am getting the exception on the call to base.resolver trying to get the connection string so i can test its value.

This works fairly well, the one issuei am finding is that i sometimes get a null reference on this line, whcih makes no sense to me:

var connectionString = base.Resolve(connectionStringName);

Risposta

you want to know if i use your cli to create a new application can i reproduce it?

21 - 30 di 47
Made with ❤️ on ABP v8.2.0-preview Updated on marzo 25, 2024, 15:11