Print Page | Close Window

OfType<T> support

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=1945
Printed Date: 21-Apr-2026 at 3:49pm


Topic: OfType<T> support
Posted By: leeatkinson
Subject: OfType<T> support
Date Posted: 06-Jul-2010 at 1:26pm
Hi

In the Silverlight client, is OfType<T> supported? It doesn't seem to be, but the list at http://www.ideablade.com/DevForceSilverlight/DevForceSilverlight_And_WCF_RIAServices_FeatureComparison.aspx suggests it is.

Lee



Replies:
Posted By: ting
Date Posted: 06-Jul-2010 at 5:31pm
Yes.  We support the entire range of operators that are available in the Entity Framework, including OfType<T>.


Posted By: leeatkinson
Date Posted: 07-Jul-2010 at 4:41am
What reference do I need to enable OfType<> in Silverlight? For example, the following doesn't work (OfType doesn't exist).

var mgr = new EntityManager();
mgr.Employees.OfType<Manager>();

I have tried the following and works - but is that functionally identical to the above?

var mgr = new EntityManager();
mgr.GetQuery<Manager>();

Lee


Posted By: ting
Date Posted: 07-Jul-2010 at 7:21pm

You might be missing a using statement.  Can you check for:

using System.Linq
 


Posted By: leeatkinson
Date Posted: 08-Jul-2010 at 4:46am
Ah - thanks!

Can I just check though - this returns an IQuerable which I can cast to EntityQuery. Does the OfType filtering still take place in the storage (in my case in SQL), rather than at either the server or the client?

Lee


Posted By: ting
Date Posted: 13-Jul-2010 at 5:40pm
Actually, no.  The filtering will be performed by the Entity Framework on the server or by DevForce on the client.  If you are using inheritance near the root of your hierarchy (as oppposed to near the leaf) and have a lot of subclasses, this will perform very poorly with the Entity Framework.



Print Page | Close Window