public IEnumerable <ISecurityStaticDataModel> GetAllExistingStaticData()
        {
            _logger.Information($"PersistenceManager: retrieving All existing security static data.");

            string commandString = "select ed.Name ExchangeName, sd.Name SecurityName, sd.Symbol, sd.ExchangeId from SecurityDetails sd\n" +
                                   "join ExchangeDetails ed on ed.Id = sd.ExchangeId";

            var securityStaticDataCollection = new List <ISecurityStaticDataModel>();

            using (IMySqlCommandWrapper commandWrapper = _commandWrapperFactory.GetCommandWrapper(commandString, _connectionWrapper))
            {
                lock (_lockObject)
                {
                    using (IMySqlDataReaderWrapper dataReader = commandWrapper.ExecuteReader())
                    {
                        while (dataReader.ReadNext())
                        {
                            string exchangeName = dataReader.GetField <string>("ExchangeName");
                            var    exchangeData = new ExchangeStaticDataModel(exchangeName);

                            string securityName = dataReader.GetField <string>("SecurityName");
                            string symbol       = dataReader.GetField <string>("Symbol");
                            var    securityData = new SecurityStaticDataModel(exchangeData, symbol, securityName);

                            securityStaticDataCollection.Add(securityData);
                        }
                    }
                }
            }

            return(securityStaticDataCollection);
        }
Esempio n. 2
0
        public IExchangeStaticDataModel GetExchangeStaticDataModel(ISecurityStaticData securityStaticData)
        {
            var exchangeStaticDataModel = new ExchangeStaticDataModel(securityStaticData.ExchangeShortName);

            return(exchangeStaticDataModel);
        }