Exemplo n.º 1
0
 private void RemoveScope(Guid id)
 {
     if (ServiceScopeDictionary.TryRemove(id, out var scope))
     {
         scope.Dispose();
     }
 }
Exemplo n.º 2
0
        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));
        }