Thanks for posting your question in the Microsoft Q&A forum.
The TrimStart
method is not supported in LINQ to SQL because it cannot be translated to SQL.
You can achieve the same result by using the SqlFunctions
class, specifically the SqlFunctions.PatIndex
method, which simulates the functionality of TrimStart
in LINQ to SQL.
_akContext.EmployeeInfos.Where(e => e.EmployeeNumber.Substring(SqlFunctions.PatIndex("%[^E]%", e.EmployeeNumber) - 1) == employeeId)
.OrderBy(e => e.EmployeeInfoId)
.Select(e => e.EmployeeInfoId)
.ToList();
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful