예제 #1
0
        public AppScope BeginScope(object tag)
        {
            var scope  = new AppScope();
            var lscope = Scope.BeginLifetimeScope(tag, b => b.Register(c => scope)
                                                  .As <IAppScope>()
                                                  .AsSelf()
                                                  .InstancePerLifetimeScope());

            scope.Scope = lscope;
            return(scope);
        }
예제 #2
0
        public AppScope BeginScope(object tag, Action <ContainerBuilder> confAction)
        {
            var scope  = new AppScope();
            var lscope = Scope.BeginLifetimeScope(tag, b =>
            {
                b.Register(c => scope)
                .As <IAppScope>()
                .AsSelf()
                .InstancePerLifetimeScope();
                confAction(b);
            });

            scope.Scope = lscope;
            return(scope);
        }