public CorrelationHandler(HttpMessageHandler innerHandler, IContextReader tokenExtractor) : base(innerHandler) { _tokenExtractor = tokenExtractor; }
public ContextGenerator(IContextReader reader) { this.reader = reader; }
public static async Task <Dictionary <ConfigurationPath, ConfigurationValue> > GetContextAndCalculate(this ITweek tweek, ICollection <ConfigurationPath> pathQuery, HashSet <Identity> identities, IContextReader contextDriver, GetLoadedContextByIdentityType externalContext = null) { var allContextData = (await Task.WhenAll(identities .Select(async identity => new { Identity = identity, Context = new Dictionary <string, JsonValue>(await contextDriver.GetContext(identity), StringComparer.OrdinalIgnoreCase) }))) .ToDictionary(x => x.Identity, x => x.Context); externalContext = externalContext ?? ContextHelpers.EmptyContextByIdentityType; var loadedContexts = ContextHelpers.GetContextRetrieverByType(ContextHelpers.LoadContexts(allContextData), identities); var context = ContextHelpers.AddSystemContext(ContextHelpers.Fallback(externalContext, loadedContexts)); var contextPaths = pathQuery.Any(x => x.IsScan) ? allContextData.Values.SelectMany(x => x.Keys) .Where(x => x.Contains("@fixed:")) .Select(x => x.Split(':')[1]) .Select(ConfigurationPath.New).ToArray() : null; return(tweek.Calculate(pathQuery, identities, context, contextPaths)); }
public static Task <Dictionary <ConfigurationPath, ConfigurationValue> > GetContextAndCalculate(this ITweek tweek, ConfigurationPath pathQuery, HashSet <Identity> identities, IContextReader contextDriver, GetLoadedContextByIdentityType externalContext = null) { return(tweek.GetContextAndCalculate(new[] { pathQuery }, identities, contextDriver, externalContext)); }
public ApplicationDbContext(IContextReader <T> reader) { Entities = reader.ReadContext(); }
public ContextGenerator (IContextReader reader) { this.reader = reader; }
/// <summary> /// Create a HttpSerivce object. /// </summary> /// <remarks> /// Will by default use a <see cref="CorrelationHandler"/> if no client was specified. /// </remarks> /// <param name="tokenExtractor"></param> /// <param name="client">Allowing to dependency inject a custom HttpClient.</param> public HttpService(IContextReader tokenExtractor, HttpClient client = null) { _tokenExtractor = tokenExtractor; _client = client ?? new HttpClient(new CorrelationHandler(new HttpClientHandler(), tokenExtractor)); }