public void Intercept(IInvocation invocation)
        {
            var envScope = EnvironmentScope.GetAmbientScope();

            if (envScope != null)
            {
                BindEnvironment(invocation.Proxy, envScope);
            }
            invocation.Proceed();
        }
        public bool CanResolve(CreationContext context,
                               ISubDependencyResolver contextHandlerResolver, ComponentModel model,
                               DependencyModel dependency)
        {
            var envScope = EnvironmentScope.GetAmbientScope();

            if (envScope == null)
            {
                return(false);
            }

            var key  = dependency.DependencyKey;
            var type = dependency.TargetItemType;

            return(envScope.HasKey(key, type) || envScope.Contains(type));
        }