I have the following linq query:
var file = (from p in database.tblFile
join o in database.tblFileVersion on p.fldFileID equals o.fldFileID
join t in database.tblFileAttachments on p.fldFileID equals t.fldFileID
where p.fldFileID == team.Key
where o.fldVersionNo == highestVersion
select new UserDashboardFile
{
Filename = p.fldFilename,
VersionNumber = o.fldVersionNo,
FileID = team.Key,
Type = GetFileType(t.fldTableName),
}).Single();
GetFileType is a method that returns an enumeration type. There is no syntax error but when I run the project (it is an mvc 4 web project) I receive the following error:
LINQ to Entities does not recognize the method 'DCIS.Code.UserDashboardFileType GetFileType(System.String)' method, and this method cannot be translated into a store expression.
I imagine that this query cannot be translated into a t-sql query but I do not know how to change my query in order to avoid the above error. Thanks in advance...