public CurrentScopeAccessor(IScopeManager scopeManager, ComponentModel componentModel)
		{
			this.scopeManager = scopeManager;
			this.componentModel = componentModel;
			var baseType = (Type)componentModel.ExtendedProperties[Constants.ScopeRoot];
			if (baseType != null)
			{
				selector = new BasedOnTypeScopeRootSelector(baseType);
			}
		}
Exemple #2
0
        public CurrentScopeAccessor(IScopeManager scopeManager, ComponentModel componentModel)
        {
            this.scopeManager   = scopeManager;
            this.componentModel = componentModel;
            var baseType = (Type)componentModel.ExtendedProperties[Constants.ScopeRoot];

            if (baseType != null)
            {
                selector = new BasedOnTypeScopeRootSelector(baseType);
            }
        }
        public ResolutionContext SelectScopeRoot(IScopeRootSelector scopeRootSelector)
        {
            var scopes   = resolutionStack.Select(c => c.Handler).ToArray();
            var selected = scopeRootSelector.Select(scopes);

            if (selected != null)
            {
                var resolutionContext = resolutionStack.SingleOrDefault(s => s.Handler == selected);
                if (resolutionContext != null)
                {
                    return(resolutionContext);
                }
            }
            return(null);
        }
		public ResolutionContext SelectScopeRoot(IScopeRootSelector scopeRootSelector)
		{
			var scopes = resolutionStack.Select(c => c.Handler).ToArray();
			var selected = scopeRootSelector.Select(scopes);
			if (selected != null)
			{
				var resolutionContext = resolutionStack.SingleOrDefault(s => s.Handler == selected);
				if (resolutionContext != null)
				{
					return resolutionContext;
				}
			}
			return null;
		}