I receive this error message:LINQ to Entities does not recognize the method 'System.Guid GetUserId()' method, and this method cannot be translated into a store expression.
This is my code:DB.Users user = db.Users.FirstOrDefault(u => u.Id == BOL.GetUserId());
BOL.GetUserId() returns a GUID of the current logged-in user (and this works works).
How can I make this LINQ code line work?Or, what is the shortest alternative?
UPDATE: In the mean time I found out that there is a difference between LINQ to SQL and Entities. I use Entities because of the TailspinSpyworks example... but my code is using LINQ to SQL. My current solution is to use a var:var userId = BOL.GetUserId();DB.Users user = db.Users.FirstOrDefault(u => u.Id == userId);
Is this a good solution? And, is the execution time of Entities faster than SQL?
View Complete Post