I have a base class called BaseEvent.
And, 3 classes derived from BaseEvent: Derived1, Derived2, Derived3
Suppose we have a following query:
Database.BaseEvents.Where(e => e.EventsCategories.Any(
c => c.EventCategories== category.OID)).ToList();
How to do that this query return collection of derived objects, not BaseEvent?
Thanks.
UPDATE:

but type should be Film
Use the
Castmethod:Assuming that is, you’ve setup Linq2Sql so that it understands your
EventCategoriesproperty is a discriminator.Update:
A discriminator field tells Linq2Sql what type it should use based on the value of a field. If you do not setup such a field. Linq2Sql will always return the base type. A google query will get you a ton of good posts on how to do this.