I am working with a WebApi application where I have written a method to get the Student using the following code:
public Student GetStudent(string studentId)
{
var student = this.context.Students.FirstOrDefault(x => x.Id == Guid.Parse(studentId));
return student;
}
Here the studentId is getting from a WebApi call. But when I tried to run this application it throws an exception like:
Additional information: LINQ to Entities does not recognize the method 'System.Guid Parse(System.String)' method, and this method cannot be translated into a store expression.
Is there any one tell me why this is occurred and how can I resolve this issue?