Sometimes you can't edit an existing type to add the necessary attributes (DelimitedRecordAttribute or FixedLengthRecordAttribute) and this information could be specified through parameters.
If the type doesn't have any attribute, you could use a default value, if this information is not specified through a parameter.
I've been annoyed when I wanted to proceed to a quick dump of data to a csv file without wanting to create a new object & copy data in order to be able to use the API.
I tried all possible engines and all of them seem to require those attributes.
Even when it doesn't seem logical : CommonEngine.RecordsToDataTable() only works when the record type has those attributes. It's not logical because I don't think it need those attributes here.
var itemList = data.GroupBy(item => new { item.NomApporteur }).Select(g => new { g.Key.NomApporteur, Somme = g.Sum(o => o.Montant) });
if (itemList.Count() > 0)
{
var engine = new DelimitedFileEngine(itemList.First().GetType());
engine.Options.Delimiter = ";";
engine.WriteFile("", itemList);
}
Today, it seems that I have to write my own RecordsToDataTable() in order to bypass this limitation.