Print Page | Close Window

AsScalarAsync for ITypedQuery?

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=2626
Printed Date: 17-Apr-2026 at 12:00am


Topic: AsScalarAsync for ITypedQuery?
Posted By: stephenmcd1
Subject: AsScalarAsync for ITypedQuery?
Date Posted: 20-Apr-2011 at 11:22am
Currently, it looks like AsScalarAsync can only be used with IEntityQuery<T>s.  I'm trying to find a way to use it for an ITypedQuery that was created dynamically.  For example, the following code works fine:

var q1 = em.GetQuery<User>();
q1.AsScalarAsync().Count(CallbackMethod);

But I want the query's type to be dynamic.  This is the code I want to write but can't:

var type = typeof (User);//In the real use, this type won't be hardcoded
var q2 = EntityQuery.Create(type);
q2.AsScalarAsync().Count(CallbackMethod); //Error: AsScalarAsync can't be used on q2.

Are there any plans to support AsScalarAsync for ITypedQueries?  Or will I need to do some tricky reflection/casting to get this to work?

Thanks,
-Stephen



Replies:
Posted By: DenisK
Date Posted: 20-Apr-2011 at 8:23pm
Hi stephenmcd1;

This is planned to be supported in 6.1.0 release which is scheduled for sometime in early to mid May. We have a 6.1.0 EAP that already supports this. Please let me know if you wish to download it.



Print Page | Close Window