Example #1
0
        public IScope CreateChildScope(Action <ITypeRegister> typeRegisterAction = null)
        {
            var childrenCollection = _services.Clone();

            if (typeRegisterAction != null)
            {
                var typeRegister = new TypeRegister();
                typeRegisterAction(typeRegister);
                MicrosoftRegistrationHelper.RegisterContextTypes(childrenCollection, typeRegister);
            }

            return(new MicrosoftScope(childrenCollection));
        }
Example #2
0
        public IScope CreateChildScope(Action <ITypeRegister> typeRegisterAction = null)
        {
            if (typeRegisterAction != null)
            {
                var childrenCollection = services.Clone();

                var typeRegister = new TypeRegister();
                typeRegisterAction(typeRegister);
                MicrosoftRegistrationHelper.RegisterContextTypes(childrenCollection, typeRegister);

                return(new MicrosoftScope(
                           childrenCollection.BuildServiceProvider().CreateScope(),
                           childrenCollection));
            }
            return(new MicrosoftScope(
                       scope,
                       services));
        }