New Posts New Posts RSS Feed: OfType<T> support
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

OfType<T> support

 Post Reply Post Reply
Author
leeatkinson View Drop Down
Newbie
Newbie


Joined: 01-Jul-2010
Posts: 17
Post Options Post Options   Quote leeatkinson Quote  Post ReplyReply Direct Link To This Post Topic: OfType<T> support
    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
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post 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>.
Back to Top
leeatkinson View Drop Down
Newbie
Newbie


Joined: 01-Jul-2010
Posts: 17
Post Options Post Options   Quote leeatkinson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 07-Jul-2010 at 7:21pm

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

using System.Linq
 
Back to Top
leeatkinson View Drop Down
Newbie
Newbie


Joined: 01-Jul-2010
Posts: 17
Post Options Post Options   Quote leeatkinson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down