Sorry at first if my title is not clear, but it's hard for me to overlay it with a simple sentence in English :).
Let's say I have a site that manages people and super heroes, I have 2 classes:
public class Person
{
[Key]
public int PersonId { get; set; }
[MaxLength(100)]
public string Name { get; set; }
}
public class SuperHero:Person
{
[MaxLength(100)]
public string SuperHeroName { get; set; }
public virtual ICollection<SuperPower> SuperPowers{ get; set; }
}
In my database, I have the following:
Person 1: Id = 1 Name = "Alex Flimster" Discriminator = "Person"
Person 2: ID = 2 Name = "Bruce Wayne" discriminator = "SuperHero" SuperHeroName = "Batman"
I know if yes:
var test = from Context.Person select p;
I get everyone, hero or not.
If I want only a hero, I would do:
var test = from Context.Person.OfType<SuperHero>() select p;
My question is: how do I get only a person?
var test = from Context.Person.OfType<Person>() select p;
It will return the same as in the first test.
Edit
, .
, 200 , 10 . , , , -.
(, "VideoGame Hero", . , )
!