我对C#还不是很熟悉。我有两个类,一个是电影类(Movie class),另一个是类型类(Genre class)。我不理解属性“public virtual Genre Genre”的含义,请问有人能解释一下吗?以下是这两个类:
public class Genre :IEntityBase
{
public Genre()
{
Movies = new List<Movie>();
}
public int ID { get; set; }
public string Name { get; set; }
public virtual ICollection<Movie> Movies { get; set; }
}
public class Movie:IEntityBase
{
public Movie()
{
Stocks = new List<Stock>();
}
public int ID { get; set; }
**public virtual Genre Genre { get; set; }**
public virtual ICollection<Stock> Stocks { get; set; }
}