开发者

Getting count of products[items] from GetProductsQuery()[GettableQuery()] of datacontext file

I am trying to get the count of rows of a table which is included in edmx and its GetQueries are defined in datacontext file (originally icnluded in domain services).

E.g.

EntityQuery<Cart> getCartsQ = from cq in _cartviewContext.GetCartsQuery() select cq;
LoadOperation<Cart> loadCartid = this._cartviewContext.Load(getCartsQ);

How can I get the count of enitities here? I used the following:

int cartCount = loadCartid.TotalEntityCount; 

But it's of no help.

Atleast let me know how can I query specific column using datacontext m开发者_开发技巧enthod(like GetProductsQuery() or GetCartsQuery).

Pls help.


All calls to the DomainService are asynchronous. This means that your client side code does not wait for the call to complete. Your problem is probably that you are checking the TotalEntityCount before the call is complete and there are not yet any results available.

Use an overload of the Load method that accepts a callback and then check the TotalEntityCount within that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜