Given the following code :
var EmployeeXPosition = from emp in context.WTDEmployee
from ep in emp.WTDEmployeeXOXPosition
select new {
EmployeeId = emp.id,
FullNameAndPosition = string.Format("{0} {1} : {2}", emp.FirstName, emp.LastName, ep.WTDPosition.Position)
};
It gives the error :
LINQ to Entities does not recognize the method 'System.String Format(System.String, System.Object, System.Object, System.Object)' method, and this method cannot be translated into a store expression.
Sure enough I could do :
emp.FirstName+" "+ emp.LastName +" : " + ep.WTDPosition.Position
But it just looks ugly, any suggestions on how to use string.Format
instead ?