Using LLBLGen 2.6, 28-Jan-2011 Release, 09-Oct-2009 build
Here is the code:
Dim trans As New Transaction(IsolationLevel.ReadCommitted, "MyLinqTrans")
Dim metaData As New LinqMetaData(trans)
Dim q As ILLBLGenProQuery = DirectCast(( _
From c In metaData.Tickets _
Where c.ProjectID = 4 AndAlso c.RequestTypeID = 2 _
Group By c.ProjectName, EnteredYear = c.DateEntered.Year, EnteredMonth = c.DateEntered.Month _
Into NumTickets = Count() _
Select ProjectName, EnteredMonth, EnteredYear, NumTickets _
), ILLBLGenProQuery)
Dim ticketRange As TicketsCollection = q.Execute(Of TicketsCollection)()
ticketRange.GetMulti(Nothing)
And the error message:
Unable to cast object of type 'System.Collections.Generic.List`1[VB$AnonymousType_3`4[System.String,System.Int32,System.Int32,System.Int32]]' to type 'IME.data.CollectionClasses.TicketCollection'.
I have looked at numerous forum posts with similar errors but nothing seems to point to my problem except maybe I should be using LLBLGen 3.1 because there are some bugs in 2.6? Maybe I read that wrong though. Either way, the project doesn't want to go to 3.1 unless we really have to. Can someone point me in the right direction with LINQ?
Alternatively, I don't even really HAVE to use LINQ for this. I just need to get a collection back with only certain fields, grouped that way and with the count. LINQ seemed like the easiest option, but now I don't know if that is the case. Any help is mucho appreciated.