Print Page | Close Window

Count of Records

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1960
Printed Date: 13-Apr-2025 at 2:40am


Topic: Count of Records
Posted By: bjmreddy
Subject: Count of Records
Date Posted: 13-Jul-2010 at 7:38am
Hello All,
 
I am using silverlight with Ideablade in one of our applications, below is the ExecuteQueryAsync method to execute query, can you guys please help me how to get count of the records other than looping through results and counting.
 
below is the code I am using
 

_mgr.ExecuteQueryAsync(_mgr.Assets.Where(a => a.ParentID == customerid ) , GotAssets, null);

I tried to use
_mgr.ExecuteQueryAsync(_mgr.Assets.Where(a => a.ParentID == customerid ).Count() , GotAssets, null);
 
but it throws error.
 
Please help or point me to similar examples.
 
 
Thanks,
 



Replies:
Posted By: ting
Date Posted: 13-Jul-2010 at 6:38pm
Yes, it should look something like this:
 
var op = _mgr.Assets.Where(a => a.ParentID == customerid).AsScalarAsync().Count();
op.Completed += new EventHandler<EntityScalarQueriedEventArgs<int>>(op_Completed);
 


Posted By: bjmreddy
Date Posted: 14-Jul-2010 at 1:19pm
Thanks for reply,
I don't have AsScalarAsync as a option, am I missing somthing here?
 
thanks


Posted By: ting
Date Posted: 14-Jul-2010 at 6:09pm
You are probably missing this:
using IdeaBlade.EntityModel;



Print Page | Close Window