-
Notifications
You must be signed in to change notification settings - Fork 349
Closed
Description
I just upgraded some code I inherited from 3.1 to 3.2 and my call to FileHelperEngine.ReadStreamAsDT(..) appears as deprecated.
So i followed the recommandation and used ReadStream(..).ToDataTable().
The problem is that the same code generates the exception "The record class Object must be marked with the [DelimitedRecord] or [FixedLengthRecord] Attribute" because I use a generated delimited class.
Doesn't the CreateRecordClass an object with the proper attributes?
Here an example of code that generates the problem :
var builder = new DelimitedClassBuilder("temp") { IgnoreFirstLines = 0, IgnoreEmptyLines = true, Delimiter = ";" };
var sr = new StreamReader(fileStream, Encoding.Default);
var headerArray = sr.ReadLine().Split(';');
foreach (var header in headerArray)
{
builder.AddField(header, typeof(string));
builder.LastField.FieldQuoted = true;
builder.LastField.QuoteChar = '"';
}
var engine = new FileHelperEngine(builder.CreateRecordClass());
//return engine.ReadStreamAsDT(sr); //Works
return engine.ReadStream(sr).ToDataTable(); //Throws exception
Metadata
Metadata
Assignees
Labels
No labels