Print Page | Close Window

Possible Bug?

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=1906
Printed Date: 11-Apr-2026 at 1:37pm


Topic: Possible Bug?
Posted By: msosa
Subject: Possible Bug?
Date 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.



Replies:
Posted By: NicoS
Date 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


Posted By: msosa
Date 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.




Posted By: ting
Date 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.)
 



Print Page | Close Window