Пример #1
0
        public static IConnector <T> CreateAndBuild(Action <IConnectorLinker <T> > buildChain,
                                                    ConnectorContext connectorContext)
        {
            var linker = new ConnectorLinker <T>(connectorContext);

            using var _ = connectorContext.BeginDepth();
            buildChain(linker);
            return(linker.Connector);
        }
Пример #2
0
        IChain IChainBuilder.BuildChain(IServiceProvider serviceProvider)
        {
            var lockStrategy     = CreateLockStrategy();
            var connectorContext = new ConnectorContext(Name, serviceProvider);
            var rootConnector    = ConnectorLinker <T> .CreateAndBuild(ConfigureRootConnector, connectorContext);

            var(connectors, initQueue) = connectorContext.Seal();

            var sourceConnectorCollection = new SourceConnectorCollection <T>(Name, serviceProvider);

            ConfigureSources(sourceConnectorCollection);
            var sourceConnectors = sourceConnectorCollection.ToArray();

            return(new Chain <T>(Name, lockStrategy, rootConnector, connectors, sourceConnectors, serviceProvider, initQueue));
        }