public ShellScope CreateScope()
        {
            if (_placeHolder)
            {
                return(null);
            }

            var scope = new ShellScope(this);

            // A new scope can be only used on a non released shell.
            if (!_released)
            {
                return(scope);
            }

            scope.Dispose();

            return(null);
        }
示例#2
0
        public ShellScope CreateScope()
        {
            // We can't create a scope with a null 'ServiceProvider' meaning that the shell has been disposed. Normally, the
            // 'ShellHost' removes the shell from its collection as soon as it is released so that a new one will be created.
            // But this may happen when a shell releases its dependent shells and disposes those that are not in use.
            if (_placeHolder || (ServiceProvider == null && Settings.State != TenantState.Disabled))
            {
                return(null);
            }

            var scope = new ShellScope(this);

            // A new scope can be only used on a non released shell.
            if (!_released)
            {
                return(scope);
            }

            scope.Dispose();

            return(null);
        }