【发布时间】:2014-05-12 08:48:56
【问题描述】:
我有一个关于如何填充 json 对象以显示具有子实体的实体的问题。那是因为我有 x 有详细实体,称为 y。
DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription("filtered_customer");
// 客户定义。 DbSyncTableDescription 客户描述 = SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.Customer", serverConn);
scopeDesc.Tables.Add(customerDescription);
// CustomerContact 的定义,包括要包含的列的列表。 集合 columnsToInclude = new Collection(); columnsToInclude.Add("CustomerId"); columnsToInclude.Add("PhoneType"); DbSyncTableDescription customerContactDescription = SqlSyncDescriptionBuilder.GetDescriptionForTable("Sales.CustomerContact", columnsToInclude, serverConn);
scopeDesc.Tables.Add(customerContactDescription);
【问题讨论】:
-
你能展示你的FavoriteStation映射吗?
-
@VladimirSachek:我添加了我的映射。谢谢你的帮助....
-
这还不够。你有像 HasRequired(t => t.Station).WithMany(t => t.FavoriteStations).HasForeignKey(d => d.StationId); 这样的映射吗?
-
延迟加载是否被禁用?
-
@BenitoBertoli 这与 LazyLoading 无关,因为应该使用 Include 方法
标签: c# entity-framework orm entity-framework-5 odata