I've used the following technique several times now with typed lists mapped to transactional data that our application accesses in both itemized and summary forms.
I use the designer to create the typed list such that it's tailored for itemized access to the data. Then, I'll inherit the list to create a 'summary' form and override the GetFieldsInfo method to tinker with the fileds collection returned. I recently wanted to apply this approach to a TypedView and noticed that the GetFieldsInfo method is not 'virtual'.
I know how to modify the TypedView template but I wanted to inquire about the rational behind not making the GetFieldsInfo method 'virtual' for TypedViews just in case there's something in that rational that renders the approach I've described above unusable in the TypedView context.
For a brief example of what I'd like to do in the typed view, code follows...
public class PubCaseFineSummaryTypedView : PubCaseFineTypedView
{
public PubCaseFineSummaryTypedView()
{
}
/* This currently isn't possible b/c GetFieldsInfo is not 'virtual' */
public override IEntityFields2 GetFieldsInfo()
{
IEntityFields2 baseFields = base.GetFieldsInfo();
EntityFields2 fields = new EntityFields2(4);
fields.DefineField(
baseFields[PubCaseFineTypedView.FieldNames.OwedAmount],
0,
AggregateFunction.Sum
);
fields.DefineField(
baseFields[PubCaseFineTypedView.FieldNames.CreditAmount],
1,
AggregateFunction.Sum
);
fields.DefineField(
baseFields[PubCaseFineTypedView.FieldNames.SuspendedAmount],
2,
AggregateFunction.Sum
);
fields.DefineField(
baseFields[PubCaseFineTypedView.FieldNames.PaidAmount],
3,
AggregateFunction.Sum
);
return fields;
}
}