using Autofac; namespace SHJX.Service.Control.Pipeline.Contents { public class PipeContent { private static readonly ConcurrentDictionary pipes = new(); public PipeContent(PipelineConfig pipeConfig, IComponentContext componentContext) { pipeConfig.PipelineContents.ForEach(pipeContent => { IPipeline content = componentContext.ResolveNamed("VirtualPipeline"); pipeContent.Nodes.ForEach(node => content.AddNode(componentContext.ResolveNamed(node))); pipes.TryAdd(pipeContent.Alias, content); }); } public static IPipeline Factory(string key) { return pipes.TryGetValue(key, out IPipeline pipeline) ? pipeline : throw new ArgumentNullException(key); } } }