public IEnumerable <TEntityType> GetAll() { string classtype = typeof(TEntityType).Name; string cmd = $"select * from {classtype}"; var dt = SqlHelpers.GetDataTable(_connection, cmd); for (int i = 0; i < dt.Rows.Count; i++) { yield return(_mapper.ConvertToEntity(dt.Rows[i])); } }