我在内容树中有如下内容的子项,并且必须显示在同一页面中。我们ModelA
为页面创建了一个类型为强类型的视图:
public class ModelA
{
public IEnumerable<ModelA > item1 { get; set; }
public IEnumerable<ModelB> item2{ get; set; }
}
内容树是:
Item1(Based on Template A and Created ModelA to access)
---Children11(Based on Template A and Created ModelA to access))
---Children12(Based on Template A and Created ModelA to access))
Item2(Based on Template A and Created ModelA to access))
---Children21(Based on Template B and Created ModelB to access))
---Children22(Based on Template B and Created ModelB to access))
我们使用GlassMapper来获取数据,因此我们定义ModelA
了 forChildren11
和for 。Children12
ModelB
Children21
Children22
我能够得到孩子,item1
但不是因为item2
它是null
。是因为玻璃映射器无法找到它们并映射它的类型ModelB
吗?