下面的代码有什么区别?
public class Album
{
public int Id { get; set; }
public string Title { get; set; }
public List<Gener> Gener { get; set; }
}
public class Gener
{
public int Id { get; set; }
public string Name { get; set; }
}
public class Albumcontext:DbContext
{
public DbSet<Album> Albums { get; set; }
public DbSet<Gener> Geners { get; set; }
}
public class Album
{
public int Id { get; set; }
public string Title { get; set; }
public Gener Gener { get; set; }
}
public class Gener
{
public int Id { get; set; }
public string Name { get; set; }
}
public class Albumcontext:DbContext
{
public DbSet<Album> Albums { get; set; }
public DbSet<Gener> Geners { get; set; }
}
我知道关系 2 实体必须使用代码 2,但如何使用 List<> 或 Collection<>?
对不起,我的英语不好