v 4.0 May 15th, 2013
I have a TypedList with two calculated fields. Used to work properly in v.3.5
Should I change anything
public partial class VentasTotalesPorProductoTypedList
{
// new column
DataColumn _columnTotal;
DataColumn _columnTotalDiscount;
protected override void OnResultsetBuilt(IEntityFields fields)
{
// expand fields and define the new ones
fields.Expand(2);
fields.DefineField(new EntityField(
"Total",
OrderDetailFields.Quantity * OrderDetailFields.UnitPrice * (1 - OrderDetailFields.Discount),
AggregateFunction.Sum,
typeof(System.Decimal)
), fields.Count - 2);
fields.DefineField(new EntityField(
"TotalDiscount",
OrderDetailFields.Quantity * OrderDetailFields.UnitPrice * OrderDetailFields.Discount,
AggregateFunction.Sum,
typeof(System.Decimal)
), fields.Count - 1);
base.OnResultsetBuilt(fields);
}
...
}
The field.Expand(2) line gives an error, because _fieldPersistenceInfos is null
SD.LLBLGen.Pro.ORMSupportClasses.EntityFields Expand method:
public override void Expand(int numberOfNewCells)
{
base.Expand(numberOfNewCells);
Array.Resize(ref _fieldPersistenceInfos, _fieldPersistenceInfos.Length + numberOfNewCells);
}
TIA