Пример #1
0
        public void Import(HandlerGraph other)
        {
            _stagedCalls.Fill(other._stagedCalls);

            other._chains.Values.Each(chain => {
                var inputType = chain.InputType();
                if (_chains.ContainsKey(inputType))
                {
                    var original = _chains[inputType];

                    chain.ToArray().Each(original.AddToEnd);
                }
                else
                {
                    _chains.Add(inputType, chain);
                }
            });
        }
Пример #2
0
        void IFubuRegistryExtension.Configure(FubuRegistry registry)
        {
            var graph    = new HandlerGraph();
            var allCalls = allSources().SelectMany(x => x.FindCalls()).Distinct();

            graph.Add(allCalls);

            graph.ApplyPolicies(_localPolicies);

            registry.AlterSettings <HandlerGraph>(x => x.Import(graph));

            registry.AlterSettings <ChannelGraph>(channels => {
                _channelAlterations.Each(x => x(channels));
            });

            registry.Configure(behaviorGraph => {
                var channels = behaviorGraph.Settings.Get <ChannelGraph>();
                behaviorGraph.Services.Clear(typeof(ChannelGraph));
                behaviorGraph.Services.AddService(typeof(ChannelGraph), ObjectDef.ForValue(channels).AsSingleton());
            });

            _alterations.Each(x => x(registry));
        }