Help needed with Linq To Sql Query
- by fearofawhackplanet
I have the concept of valid/ordered transitions. So for example, it's not possible to move to status In progress from status Complete.
Current and Next in table StatusTransition are FK (StatusType.Id).
The Linq generator has created the following relations:
Child Property Name: StatusTransitions1
Parent Property Name: StatusType1
Participating Properties: StatusType.Id -> StatusTransition.Next
Child Property Name: StatusTransitions
Parent Property Name: StatusType
Participating Properties: StatusType.Id -> StatusTransition.Current
I'm normally ok with Linq but I'm having difficulty getting the list of valid Next StatusTypes from the Current status.
public List<StatusType> GetValidStatusTransitions(int statusId)
{
// trying to write something like the following
// (obviously not correct)
return _statusRepository
.Where(s => s.Id == statusId)
.Next.StatusTypes;
}