Example #1
0
        // TODO: add optional params to be converted into datatable or just accept a datatable
        public IEnumerable <IEnumerable <string> > GetData()
        {
            var sqlConfig = sqlConfigs.First(c => c.CommandName == "Data");

            var sqlParams = (sqlConfig.SqlParams == null) ? new Dictionary <string, object>() :
                            new Dictionary <string, object>(sqlConfig.SqlParams);

            using (var conn = connectionService.GetConnection(sqlConfig.ConnectionName))
            {
                using (var cmd = connectionService.GetCommand(sqlConfig.CommandText, conn, sqlParams))
                {
                    using (var rdr = cmd.ExecuteReader())
                    {
                        do
                        {
                            yield return(mappingService.GetDocumentData(rdr));
                        } while (rdr.NextResult());
                    }
                }
            }
        }