private void RemoveScope(Guid id) { if (ServiceScopeDictionary.TryRemove(id, out var scope)) { scope.Dispose(); } }
public async Task <IValueProvider> BindAsync(BindingContext context) { await Task.Yield(); var scope = ServiceScopeDictionary.GetOrAdd(context.FunctionInstanceId, (_) => _serviceProvider.CreateScope()); var value = scope.ServiceProvider.GetRequiredService(_type); return(await BindAsync(value, context.ValueContext)); }