While working with Entity Framework I got below error:

Image 1.
Basically what happen when you work with Entity
Framework: EF tries to translate your query into SQL, and while doing that it
doesn't seem to take into account your type conversion operators. Simply use
this query instead:
Change your Code:
From:
public List<EmployeeDetailDataContract>
EmployeeDetails(string EMP_ID)
{
var query = (from a in ctx.EmployeeDetails
where a.Emp_ID.Equals(EMP_ID)
select a).Distinct();
List<EmployeeDetailDataContract> EMPDetailList =
new List<EmployeeDetailDataContract>();
if (query.ToList().Count > 0)
{
query.ToList().ForEach(rec
=>
{
EMPDetailList.Add(new EmployeeDetailDataContract
{
Emp_ID = Convert.ToString(rec.Emp_ID),
Emp_DetailID = Convert.ToString(rec.Emp_DetailID),
ProjectName =
rec.ProjectName,
ManagerName =
rec.ManagerName,
City = rec.City,
Mobile = rec.Mobile
});
});
}
return EMPDetailList;
}
To:
public List<EmployeeDetailDataContract>
EmployeeDetails(string EMP_ID)
{
int EmpID = Convert.ToInt32(EMP_ID);
var query = (from a in ctx.EmployeeDetails
where a.Emp_ID == EmpID
select a).Distinct();
List<EmployeeDetailDataContract> EMPDetailList =
new List<EmployeeDetailDataContract>();
if (query.ToList().Count > 0)
{
query.ToList().ForEach(rec
=>
{
EMPDetailList.Add(new EmployeeDetailDataContract
{
Emp_ID = Convert.ToString(rec.Emp_ID),
Emp_DetailID = Convert.ToString(rec.Emp_DetailID),
ProjectName =
rec.ProjectName,
ManagerName =
rec.ManagerName,
City = rec.City,
Mobile = rec.Mobile
});
});
}
return EMPDetailList;
}
Now Run Your
Application:

Image 2.