New Posts New Posts RSS Feed: Possible Bug?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Possible Bug?

 Post Reply Post Reply
Author
msosa View Drop Down
Newbie
Newbie
Avatar

Joined: 04-Feb-2009
Posts: 6
Post Options Post Options   Quote msosa Quote  Post ReplyReply Direct Link To This Post Topic: Possible Bug?
    Posted: 22-Jun-2010 at 2:46pm
Hi, Im having a problem with the model generation. For example if I create an entity (named Person) and then another derived (via Add/Inheritance, named User), I only get an entityquery for Person, not for User.How can I retrieve all the Users only?
Im using the latest trial of devforce for SL.

Thanks.
Back to Top
NicoS View Drop Down
Newbie
Newbie


Joined: 21-Jun-2010
Posts: 8
Post Options Post Options   Quote NicoS Quote  Post ReplyReply Direct Link To This Post Posted: 23-Jun-2010 at 6:51am
Hi,
 
What i have noticed during my evaluation of DevForce is that the Person entityquery in your case can return all derived classes of Person.
To retrieve the User objects i used a query something like this:
 
var q = from p in manager.Persons
            where p is User
            select p;
 
I couldnt find OfType linq support.
I didnt test if all Person objects where transfed over the wire or that only Users where transferd.
 
Correct me if im wrong, im a newbie.
 
Hth, best regagrds,
Nico Schoemaker
Back to Top
msosa View Drop Down
Newbie
Newbie
Avatar

Joined: 04-Feb-2009
Posts: 6
Post Options Post Options   Quote msosa Quote  Post ReplyReply Direct Link To This Post Posted: 23-Jun-2010 at 11:09am
Nico, thanks for you reply. I'd tried what you suggested and you are correct! I had to change the thinks a little bit, but it worked.

I was using a Query so:

            var query = mgr.Persons.Where(p => p is User).Select(p => p as User);

That gave me what I needed.

Thanks a lot.


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: 23-Jun-2010 at 6:19pm
Be very careful with inheritance in the Entity Framework.  If you have many subclasses for a common base table, the performance can be extremely bad.
 
(For others reading this thread, note that this is different from an injected base class, which is purely a .NET object model concept that is independent from the data store - and works just fine.)
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down