diff --git a/src/Geta.Optimizely.ProductFeed.Csv/CsvFeedExporter.cs b/src/Geta.Optimizely.ProductFeed.Csv/CsvFeedExporter.cs index 4df0a6c..0390015 100644 --- a/src/Geta.Optimizely.ProductFeed.Csv/CsvFeedExporter.cs +++ b/src/Geta.Optimizely.ProductFeed.Csv/CsvFeedExporter.cs @@ -1,6 +1,7 @@ // Copyright (c) Geta Digital. All rights reserved. // Licensed under Apache-2.0. See the LICENSE file in the project root for more information +using System.Collections; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -30,8 +31,17 @@ public override object ConvertEntry(TEntity entity, HostDefinition host, Cancell public override byte[] SerializeEntry(object value, CancellationToken cancellationToken) { - _writer.WriteRecord(value); - _writer.NextRecord(); + // Handle collections (e.g., IEnumerable) by writing all records. + // Use non-generic IEnumerable to avoid generic invariance issues. + if (value is IEnumerable enumerable && value is not string) + { + _writer.WriteRecords(enumerable); + } + else + { + _writer.WriteRecord(value); + _writer.NextRecord(); + } return []; }