I'm working with C# and .NET Framework 4.5.1 retrieving data from a SQL Server database with Entity Framework 6.1.3.
I have this:
codes = codesRepo.SearchFor(predicate) .Select(c => new Tuple<string, byte>(c.Id, c.Flag)) .ToList();
And when I run it, I get this message:
Only parameterless constructors and initializers are supported in LINQ
I don't know how I have to create the Tuple because all the examples that I have found are mostly like this one.
I have tried this:
codes = codesRepo.SearchFor(predicate) .Select(c => Tuple.Create(c.Id, c.Flag)) .ToList();
And get this error:
LINQ to Entities does not recognize the method
Create[String,Byte](System.String, Byte)' method, and this method
cannot be translated into a store expression.
Where is the problem?