亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

實體框架-包括多個屬性級別

實體框架-包括多個屬性級別

LEATH 2019-07-06 15:13:31
實體框架-包括多個屬性級別include()方法對于對象上的列表非常有效。但如果我需要深入兩層呢?例如,下面的方法將返回ApplicationServers,其中包含這里顯示的屬性。但是,ApplicationsWithOverrideGroup是另一個包含其他復雜對象的容器。我也可以在那個屬性上做一個include()嗎?或者如何使該屬性完全加載?目前,這種方法:public IEnumerable<ApplicationServer> GetAll(){     return this.Database.ApplicationServers         .Include(x => x.ApplicationsWithOverrideGroup)                         .Include(x => x.ApplicationWithGroupToForceInstallList)         .Include(x => x.CustomVariableGroups)                         .ToList();}只填充已啟用的屬性(下面),而不填充Application或CustomVariableGroup屬性(如下)。我該怎么做?public class ApplicationWithOverrideVariableGroup : EntityBase{     public bool Enabled { get; set; }     public Application Application { get; set; }     public CustomVariableGroup CustomVariableGroup { get; set; }}
查看完整描述

3 回答

?
慕蓋茨4494581

TA貢獻1850條經驗 獲得超11個贊

如果我正確地理解了您,那么您將詢問是否包含嵌套屬性。如果是這樣的話:

.Include(x => x.ApplicationsWithOverrideGroup.NestedProp)

.Include("ApplicationsWithOverrideGroup.NestedProp")

.Include($"{nameof(ApplicationsWithOverrideGroup)}.{nameof(NestedProp)}")


查看完整回答
反對 回復 2019-07-06
  • 3 回答
  • 0 關注
  • 469 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號