如何在viewmodel中使用域模型关系?

时间:2015-06-15 06:37:15

标签: c# asp.net-mvc entity-framework

我正在使用viewmodel将域模型与数据表示分开,但我无法了解如何使用域模型中存在的数据库表关系。 例如,这个域模型类应该如何在viewmodel中使用?在这个例子中,CurrencyDictionary是具有Settings表的外键的表。

public partial class Settings
{
    public int Id { get; set; }
    ...List of properties...
    public int ShopCurrency { get; set; }
    public IEnumerable<SelectListItem> CurrencyList { get; set; }     
    public virtual CurrencyDictionary CurrencyDictionary { get; set; }
}

1 个答案:

答案 0 :(得分:0)

对于任何相关的给定域模型,您都有相应的视图模型,因此您的None视图模型将包含相应的Settings视图模型,如:

CurrencyDictionary
相关问题