如果我有一个模型应该包含一个集合,例如 book -> authors
我是怎么做到的
像:
public class Book
{
public string Title { get; set; }
public List<Author> Authors { get; set; }
}
或者更像:
public class Book
{
public string Title { get; set; }
public List<AuthorViewModel> Authors { get; set; }
}
这两者中哪一个是更常见的方法,我如何从 ViewModel 中获取视图?