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);
			}
		}
Esempio n. 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);
        }
Esempio n. 4
0
		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;
		}