コード例 #1
0
        public static ExplicitArguments ToExplicitArgs(this ServiceArguments arguments)
        {
            var explicits = new ExplicitArguments();

            arguments.EachService((type, o) => explicits.Set(type, o));

            return(explicits);
        }
コード例 #2
0
        public IActionBehavior StartInnerBehavior()
        {
            _scope = _windsorContainer.BeginScope();

            _arguments.EachService((type, value) => _windsorContainer.Register(Component.For(type).Instance(value).LifestyleScoped()));

            return(_windsorContainer.Resolve <IActionBehavior>(_behaviorId.ToString()));
        }
コード例 #3
0
        public IActionBehavior StartInnerBehavior()
        {
            _nested = _container.GetNestedContainer();
            _nested.Configure(x => _arguments.EachService((type, value) => x.For(type).Use(value)));
            var behavior = _nested.GetInstance <IActionBehavior>(_behaviorId.ToString());

            return(behavior);
        }
コード例 #4
0
        public IActionBehavior StartInnerBehavior()
        {
            _nestedScope = _lifetimeScope.BeginLifetimeScope(
                builder => _arguments.EachService((type, value) => builder.Register(context => value).As(type)));

            var behavior = _nestedScope.ResolveNamed <IActionBehavior>(_behaviorId.ToString());

            return(behavior);
        }
コード例 #5
0
        public override void Execute <T>(ServiceArguments arguments, Action <T> action)
        {
            using (var nested = _container.GetNestedContainer())
            {
                var explicits = new ExplicitArguments();
                arguments.EachService(explicits.Set);

                action(nested.GetInstance <T>(explicits));
            }
        }
コード例 #6
0
        public void Invoke()
        {
            using (var nested = _container.GetNestedContainer())
            {
                nested.Configure(x => _arguments.EachService((type, value) => x.For(type).Use(value)));
                var behavior = nested.GetInstance <IActionBehavior>(_behaviorId.ToString());

                behavior.Invoke();
            }
        }
コード例 #7
0
        public void Invoke()
        {
            using (var nested = _container.GetNestedContainer())
            {
                nested.Configure(cfg => _arguments.EachService((type, value) => cfg.For(type).Use(value)));

                var request = nested.GetInstance <IFubuRequest>().Get <CurrentRequest>();

                if (request.Url.StartsWith("/_content"))
                {
                    nested.GetInstance <IActionBehavior>(_arguments.ToExplicitArgs(), _behaviorId.ToString()).Invoke();
                    return;
                }

                nested.ExecuteInTransactionWithoutNestedContainer <IContainer>(invokeRequestedBehavior);
            }
        }
コード例 #8
0
 public static void Apply(this IContainer container, ServiceArguments arguments)
 {
     arguments.EachService(container.Inject);
 }
コード例 #9
0
 public static void Apply(this IContainer container, ServiceArguments arguments)
 {
     arguments.EachService(container.Inject);
 }