public static T GetRequiredItem <T>(this IItemsHolder pipelineContext, string key) where T : class { if (!pipelineContext.TryGetItem <T>(key, out var item)) { Require.Fail($"Could not get required item: {key}"); } return(item); }
public static void ReplaceTokens(this IItemsHolder pipelineContext, JToken doc, IDictionary <string, IReadOnlyCollection <string> > groups) { if (!pipelineContext.TryGetItem("TokenGroups", out IDictionary <string, IDictionary <string, int> > tokenGroups)) { tokenGroups = new Dictionary <string, IDictionary <string, int> >(); pipelineContext.SetItem("TokenGroups", tokenGroups); } Replace(doc, groups, new TokenHolder(tokenGroups)); }
public static T GetItem <T>(this IItemsHolder pipelineContext, string key) where T : class { pipelineContext.TryGetItem <T>(key, out var item); return(item); }
public bool TryGetItem <T>(string key, out T item) { return(_itemsHolder.TryGetItem(GetEffectiveItemKey(key), out item)); }