-1
我在域層(實體框架)兩個相關實體: TaxGroup TaxSubGroup TaxGroup實體屬於TaxGroup實體(一對多關係)。我必須在哪裏嵌入這種關係(datamodel或viewmodel)?模型 - 視圖 - viemodel圖案
編輯
這個datamodel的實現呢?
public class TaxGroupDataModel : DataModel
{
private readonly TaxGroup _taxGroup;
private readonly IEnumerable<TaxSubGroup> _taxSubGroups;
public TaxGroupDataModel(TaxGroup taxGroup)
{
if (taxGroup == null) { throw new ArgumentNullException("taxGroup"); }
_taxGroup = taxGroup;
_taxSubGroups = taxGroup.SubGroups;
}
public IEnumerable<TaxSubGroup> TaxSubGroups { get { return _taxSubGroups; } }
public TaxGroup TaxGroup { get { return _taxGroup; } }
}
恐怕ib都:) – 2011-11-08 11:00:39