LastIndexOf in LINQ to Entities
c#, entity-framework, linq, linq-to-entities, sql-server
Solution
You could try
OrderBy(e => e.StringProperty.Length - EntityFunctions.Reverse(e.StringProperty).IndexOf("ooF"))
I think `Reverse` and `IndexOf` are supported.
Problem
I'm using LINQ to Entities to fetch elements from a MSSQL data base and I need them sorted by the last index of a string: ``` var data = db.GetEntities(). OrderBy(e=>e.StringProperty.LastIndexOf("Foo")).ToList() ``` However, LINQ to Entities does not support `LastIndexOf`. I've tried searching for similar questions but all I've found was this which does not address my issue (ordering). Searching on MSDN did not yield any results. What would be the simplest way to accomplish this using LINQ to Entities (I don't want to have to do this after the `ToList())`.