EPPlus.DataExtractor
EPPlus.DataExtractor copied to clipboard
Extend termination criteria
Hi,
I really like the simple approach, but imho DataExtractor.GetData() termination is lacking: it can either terminate based on the row number or on the value of a single property. I propose to extend the termination test like this:
`
///
int row = fromRow;
while(true)
{
var dataInstance = new TRow();
bool continueExecution = true;
for (int index = 0; continueExecution && index < this.propertySetters.Count; index++)
continueExecution = this.propertySetters[index].SetPropertyValue(dataInstance, row, this.worksheet.Cells);
if (!continueExecution)
{
yield return dataInstance;
break;
}
foreach (var collectionPropertySetter in this.collectionColumnSetters)
collectionPropertySetter.SetPropertyValue(dataInstance, row, this.worksheet.Cells);
foreach (var simpleCollectionColumnSetter in this.simpleCollectionColumnSetters)
simpleCollectionColumnSetter.SetPropertyValue(dataInstance, row, this.worksheet.Cells);
if(!whileFunc(row, dataInstance))
break;
yield return dataInstance;
row++;
}
}
`