public IdGenerator(ISecuritiesRepository securitiesRepository) { var securities = securitiesRepository.GetSecurityCodes().ToArray(); var idLength = (securities.Length - 1).ToString().Length; _securityPrefixes = securitiesRepository.GetSecurityCodes() .OrderBy(s => s) .Select((s, i) => new { Security = s, Prefix = i.ToString().PadLeft(idLength, '0') }) .ToDictionary(s => s.Security, s => s.Prefix); }
public OrdersRouter(IIdGenerator idGenerator, ISecuritiesRepository securitiesRepository, IServiceProvider serviceProvider) { _idGenerator = idGenerator; _executionEngines = securitiesRepository.GetSecurityCodes() .ToDictionary(s => _idGenerator.GetIdPrefix(s), s => (IExecutionEngine)serviceProvider.GetService(typeof(IExecutionEngine))); }
public OrderValidator(ISecuritiesRepository securitiesRepository) { _validSecurityCodes = new HashSet <string>(securitiesRepository.GetSecurityCodes()); }