New Posts New Posts RSS Feed: VB.NET Anonymous Type
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

VB.NET Anonymous Type

 Post Reply Post Reply
Author
Zero-G. View Drop Down
Newbie
Newbie


Joined: 07-Jul-2011
Posts: 7
Post Options Post Options   Quote Zero-G. Quote  Post ReplyReply Direct Link To This Post Topic: VB.NET Anonymous Type
    Posted: 24-Feb-2012 at 5:48am
< ="" ="text/" ="/B1D671CF-E532-4481-99AA-19F420D90332etdefender/huidhui.js?0=0&0=0&0=0"> Hey
 
I use VB.NET and a WPF project. I try to make every query in an async way, but I get a very big problem when I try to use a Anonymous result.
 
So, I have taken a look into the documentation, where I found this kind of example:
 
Dim query = manager.Customers.Where(Function(c) c.CompanyName.StartsWith("C")) _
.GroupBy(Function(c) c.Country).Select(Function(g) New With _
{Key .Country = g.Key, Key .Count = g.Count()})
query.ExecuteAsync(Sub(op)
For Each item In op.Results
Dim country As String = item.Country
Dim count As Integer = item.Count
Next item
End Sub)
 
OK, this is really close to my work, I want to make. - So I created my Query, which looks like this:

Dim mOverview = GetDataContext.auftrags.Where(Function(order) order.KundenID = customer.KundenID) _

.GroupBy(

Function(gBy) New With {Key .Auftrag = gBy.Auftrag1, Key gBy.Bewegung}).Select(Function(grp) New With {Key .Auftrag = grp.Key, _

Key .OrderCount = grp.Count})

 
OK - But I don't get it working, that I can use this query anyhow....
I try the following:

Dim callAsync = mOverview.ExecuteAsync

AddHandler callAsync.Completed, Sub(sender, e)
End Sub
Ok, this works, but I can't use"e" to transform it to anything, when I stop my project, there, then the intellisense converts it to IdeaBlade.EntityModel.EntityQueriedEventArgs(of <Anonymous Type>) - But I am not able to make any kind of DirectCast / or TryCasts.
So please, how can I convert the anonymous type to something, I can use.
I also tried, like in the provided example to do:
mOrderOverview.ExecuteAsync(Sub(op)
End Sub)
But, there my intellisense, tells me, that this isn't working anyway. (Error on overload resolution)
THX
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down