I'm using a CASE
statement in my EntityDataSource to do custom sorting. Consider the following code:
<asp:EntityDataSource ID="myEntityDataSource" runat="server" ConnectionString="name=MySQLEntities1" DefaultContainerName="MySQLEntities1" EnableFlattening="False" EntitySetName="Persons" EntityTypeFilter="Persons" OrderBy="it.[Pack], CASE it.[Type] WHEN 'MAN' THEN 1 WHEN 'VROUW' THEN 2 WHEN 'KIND' THEN 3 END, it.[BirthDate] ASC" />
In T-SQL this would be a perfecty normal way of sorting, but used in the EntityDataSource
it throws the following exception:
The query syntax is not valid. Near identifier 'it', line 11, column 21.
How can I get this type of sorting to work in my EntityDataSource
?