I can't for the life of me figure out why this query isn't running
It compiles correctly, but fails during runtime when trying to do the .ToList() with the error shown below after the code.
I've reviewed the similar answers but it seems each one is specific with their issues.
I split the Query into multiple lines to try to narrow down the offending code, and it seems to be on line after "// Partition Over and Produce RowCount for each partition" but I can't figure it out.
I borrowed the logic for the GroupBy/Partition from this: Row_number over (Partition by xxx) in Linq?
[DataContract(Name = "Checksum")]
public class Checksum
{
[DataMember(Name = "SortColumn")]
public DateTime SortColumn { get; set; }
[DataMember(Name = "Identifier")]
public string Identifier { get; set; }
[DataMember(Name = "Seqnum")]
public int Seqnum { get; set; }
}
public void TestLinQ()
{
myObjectContext context = new myObjectContext();
DateTime startDate = new DateTime();
IQueryable<Signin> iQ = context.Signin;
iQ = iQ.OrderBy(o => o.LastUpdateTimeStamp);
iQ = iQ.Where(x=>x.LastUpdateTimeStamp == startDate);
// Partition Over and Produce RowCount for each partition
IQueryable<Checksum> iQ2 = iQ.GroupBy(x => x.LastUpdateTimeStamp).Select(g => new { g, count = g.Count() }).SelectMany(t => t.g.Select(b => b).Zip(Enumerable.Range(1, t.count), (j, i) => new Checksum { SortColumn = j.LastUpdateTimeStamp, Identifier = j.SigninId, Seqnum = i }));
iQ2 = iQ2.Where(x => x.Seqnum < 1000);
// Build Checksum Code
List<Checksum> outlist = iQ2.ToList();
// End Build Checksum Code
}
Result Message:
Test method WebRole1.Tests.ContinuationTokenTests.TestLinQ threw exception: System.NotSupportedException: LINQ to Entities does not recognize the method 'System.Collections.Generic.IEnumerable'1[WebRole1.Tests.Checksum] Zip[Signin,Int32,Checksum](System.Collections.Generic.IEnumerable'1[iSignRepo.Models.Signin], System.Collections.Generic.IEnumerable'1[System.Int32], System.Func`3[iSignRepo.Models.Signin,System.Int32,WebRole1.Tests.Checksum])' method, and this method cannot be translated into a store expression.