nl_05
10/06/2023, 5:50 AMpublic async Task SaveReferralOrganisation(ReferralOrganisation referralOrganisation)
{
using IEfCoreScope<ReferralOrganisationContext> scope = _referralOrganisationContextEfCoreScopeProvider.CreateScope();
await scope.ExecuteWithContextAsync<Task>(async db =>
{
db.ReferralOrganisation.Add(referralOrganisation);
await db.SaveChangesAsync();
});
scope.Complete();
}
but Im getting this error
> System.InvalidOperationException: 'The Scope 8640247c-4ebb-4e8b-8121-ebb935376e0b being disposed is not the Ambient Scope 062154f1-4f4f-4f59-bdf6-0c768a4951eb. This typically indicates that a child Scope was not disposed, or flowed to a child thread that was not awaited, or concurrent threads are accessing the same Scope (Ambient context) which is not supported. If using Task.Run (or similar) as a fire and forget tasks or to run threads in parallel you must suppress execution context flow with ExecutionContext.SuppressFlow() and ExecutionContext.RestoreFlow().'
>
Anyone have already experienced this before ?