private IEnumerable <object> MapTableToObjects(DataTable table) { foreach (DataRow row in table.Rows) { var typeName = row[DiscriminatorColumn].ToString(); if (string.IsNullOrEmpty(typeName)) { continue; } object obj; try { var dictionary = MapToDictionary(row); var type = _typeRegistry.FirstOrDefault(typeName); if (type == null) { throw new ArgumentException($"{typeName} is not a registered type."); } obj = _mapper.CreateObject(type, dictionary); } catch (Exception ex) { obj = new CorruptObject { Description = string.Join(", ", row.ItemArray), Exception = ex }; } yield return(obj); } }