LLBL version: 2.5 Final
Database: SQL
I am attempting to manage a related collection of an entity in-memory so that I do not have to save the parent entity every time the user adds/removes an association. I have created an EntityView out of the collection so that I can issues a predicate expression to filter out entities in the related collection, and had hoped to be able to sort the EntityView on a field that is related to the collection. Is it possible to sort a collection(view) in-memory by a related field?
Here is an example of my code:
ReportConfigurationCollection reportConfig = this.CurrentStateToConfigure.ReportConfigurationCollectionViaReportConfiguration_State;
PredicateExpression selectExp = new PredicateExpression();
selectExp.Add(new FieldCompareValuePredicate(ReportConfigurationFields.ReportID, ComparisonOperator.Equal, ApplicationConstants.BT_GRANT_REPORTID));
selectExp.Add(new FieldCompareValuePredicate(ReportConfigurationFields.IsFA, ComparisonOperator.Equal, "True"));
SortExpression sorter = new SortExpression();
sorter.Add(new SortClause(BFYFields.BFY, SortOperator.Ascending));
sorter.Add(new SortClause(CANFields.CAN, SortOperator.Ascending));
EntityView<ReportConfigurationEntity> configurations = new EntityView<ReportConfigurationEntity>(reportConfig);
configurations.Filter = selectExp;
configurations.Sorter = sorter;
this.gvFAConfig.DataSource = configurations;
this.gvFAConfig.DataBind();
The Sorter does not do anything to the EntityView, nor does it throw an exception.