【发布时间】:2012-10-30 08:57:19
【问题描述】:
考虑到这个 ViewModel
public class DocumentReferenceViewModel
{
public int IdDocumentReference { get; set; }
public string DocumentTitle { get; set; }
public string PageNbr { get; set; }
public string Comment { get; set; }
}
- DocumentTitle 是 Document 对象的属性
- IdDocumentReference 和 PageNumber 是 DocumentReference 对象
Document 和 DocumentReference 与属性 IdDocument
相关联- 我有一个可以返回 Document 对象的存储库
- 我有一个可以返回 DocumentReference 对象的存储库
public class DocumentReference
{
public int IdDocumentReference;
public string PageNbr { get; set; }
public string Comment { get; set; }
}
public class Document
{
public int IdDocument;
public string DocumentTitle { get; set; }
}
如何从这 2 个对象(表)中绑定 ViewModel 而无需循环 DocumentReference 并且每个都查询数据库以检索 de DocumentTitle ?
ps:我没有使用 EF,我有调用手写存储过程的存储库
【问题讨论】:
标签: c# asp.net sql asp.net-mvc repository