You are looking of OfType
and Concat
extension methods.
To get only LongStory instances you just need to call:
var longStories = context.Stories.OfType<LongStory>().ToList();
To get your bigger query it is little bit more complex. You can either try:
var allStories = context.Stories
.OfType<GenericStory>()
.Include("StoryType") // I'm not sure how this works with concat
.Concat(
context.Stories.OfType<LongStory>.Concat(
context.Stories.OfType<CoOpStory>()));
Or you can do a projection:
var allStories = context.Stories
.OfType<GenericStory>()
.Select(s => new { s.Title, s.StoryType.Name })
.Concat(
context.Stories
.OfType<LongStory>
.Select(s => new { s.Title, "LongStory" })
.Concat(
context.Stories
.OfType<CoOpStory>()
.Select(s => new { s.Title, Type })));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…