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); }
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); }
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); }
private PlacementDirector ResolveDirector(PlacementStrategy strategy) { return(directors[strategy.GetType()]); }