views:

38

answers:

1

Hi All,

I've been scratching my head here for a while now... I have a Consumer class and a BillableConsumer class that inherits Consumer. They are both a part of the Consumers set. The problem is that this following query:

Consumer consumer = (from c in _ctx.Consumers where c.ID = id select c).First();

returns a BillableConsumer instance! Just the same as this query:

BillableConsumer bconsumer = (from c in _ctx.Consumers.OfType<BillableConsumer>() where c.ID = id select c).First();

How can I return an instance of just the base class? (these are separate tables in the data store).

+2  A: 

Yes this is a little tricky.

But I did a tip on this a while back

Hope this helps

Alex

Alex James
for completeness, I would suggest posting the code sample in your answer, and point to your own blog for more information.
Davy Landman