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