private IActivationSelector ResolveSelector(PlacementStrategy strategy, bool addIfDoesNotExist = false)
        {
            IActivationSelector result;
            var strategyType = strategy.GetType();

            if (!this.selectors.TryGetValue(strategyType, out result) && addIfDoesNotExist)
            {
                result = this.serviceProvider.GetRequiredServiceByKey <Type, IActivationSelector>(strategyType);
                this.selectors[strategyType] = result;
            }

            return(result ?? defaultActivationSelector);
        }
        private IPlacementDirector ResolveDirector(PlacementStrategy strategy)
        {
            IPlacementDirector result;
            var strategyType = strategy.GetType();

            if (!this.directors.TryGetValue(strategyType, out result))
            {
                result = this.serviceProvider.GetRequiredServiceByKey <Type, IPlacementDirector>(strategyType);
                this.directors[strategyType] = result;
            }

            return(result);
        }
示例#3
0
        private IPlacementDirector ResolveDirector(PlacementStrategy strategy)
        {
            IPlacementDirector result;
            var strategyType = strategy.GetType();

            if (!this.directors.TryGetValue(strategyType, out result))
            {
                var directorType = typeof(IPlacementDirector <>).MakeGenericType(strategyType);
                result = (IPlacementDirector)this.serviceProvider.GetRequiredService(directorType);
                this.directors[strategyType] = result;
            }

            return(result);
        }
示例#4
0
        private IActivationSelector ResolveSelector(PlacementStrategy strategy, bool addIfDoesNotExist = false)
        {
            IActivationSelector result;
            var strategyType = strategy.GetType();

            if (!this.selectors.TryGetValue(strategyType, out result) && addIfDoesNotExist)
            {
                var directorType = typeof(IActivationSelector <>).MakeGenericType(strategyType);
                result = (IActivationSelector)this.serviceProvider.GetRequiredService(directorType);
                this.selectors[strategyType] = result;
            }

            return(result ?? defaultActivationSelector);
        }
示例#5
0
 private PlacementDirector ResolveDirector(PlacementStrategy strategy)
 {
     return(directors[strategy.GetType()]);
 }