I am trying to sort by a child entity. I am using version 2.6. I've set up the code this way:
EntityCollection<ScheduleTemplateEntity> schedules = new EntityCollection<ScheduleTemplateEntity>(new ScheduleTemplateEntityFactory());
RelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(ScheduleTemplateEntity.Relations.ScheduleDetailEntityUsingCompanyIdScheduleId);
bucket.Relations.Add(ScheduleDetailEntity.Relations.DaysOfWeekEntityUsingCompanyIdDayOfWeekId);
SortExpression sort = new SortExpression(DaysOfWeekFields.SortOrder | SortOperator.Ascending);
adapter.FetchEntityCollection(schedules, null, 0, sort);
return schedules;
When the query runs, it throws this error:
SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException was unhandled
Message="An exception was caught during the execution of a retrieval query: Correlation name 'DaysOfWeek' not found. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception."
Source="SD.LLBLGen.Pro.ORMSupportClasses.NET20"
RuntimeBuild="08042008"
RuntimeVersion="2.6.0.0"
QueryExecuted="\r\n\tQuery: SELECT [DBA].[ScheduleTemplate].[CompanyID] AS CompanyId, [DBA].[ScheduleTemplate].[ScheduleTemplateID] AS ScheduleTemplateId,
[DBA].[ScheduleTemplate].[ScheduleTemplateName], [DBA].[ScheduleTemplate].[AdjustToFixedSchedule], [DBA].[ScheduleTemplate].[ArriveEarlyWithinLength], [DBA].[ScheduleTemplate].[ArriveLateWithinLength] FROM [DBA].[ScheduleTemplate] ORDER BY [DBA].[DaysOfWeek].[SortOrder] ASC\r\n"
I am hoping that this is something simple that I have missed.
Thanks for your help!
Allen