简体   繁体   English

嵌套对象和Aspose.Words LINQ语法

[英]Nested objects and Aspose.Words LINQ syntax

How I can use nested objects in Aspose.Words LINQ templates? 如何在Aspose.Words LINQ模板中使用嵌套对象? Fe I want to write something like that in a template Fe我想在模板中写类似的东西

<<[Person.Related.Car.Model]>>

Is that achivable in Aspose.Words LINQ templates? 在Aspose.Words LINQ模板中可以实现吗?

Please check the following article: Working with DataRow and DataRowView Objects 请检查以下文章: 使用DataRow和DataRowView对象

In order to make this work, you need to change your template like this: 为了使这项工作有效,您需要像这样更改模板:

<<[Person.Related.First().Car.First().Model]>>

Or like this: 或像这样:

<<foreach [in Person.Related]>><<foreach [in Car]>><<[Model]>><</foreach>><</foreach>>

Also, you can implement regular .NET classes - Person, Related, Car - and use XML deserialization. 另外,您可以实现常规.NET类-Person,Related,Car-并使用XML反序列化。 Then, it would be possible for you to use the wanted syntax, if an instance of the Person class is passed to the engine. 然后,如果将Person类的实例传递给引擎,则可以使用所需的语法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM