Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Geta.Optimizely.ProductFeed.Csv/CsvFeedExporter.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<CsvEntry>) 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 [];
}
Expand Down
Loading