您好我有像heirarchial对象结构
public class Department
{
public Guid ID {get; set;}
public string Name{get; set;}
}
public class Employee
{
public Guid ID {get; set;}
public string Name{get; set;}
public Department Department {get;set;}
}
我创建了一个formatedoutput.ps1xml文件显示在PowerShell中的员工对象
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<ViewDefinitions>
<View>
<Name>EmpView</Name>
<ViewSelectedBy>
<TypeName>Employee</TypeName>
</ViewSelectedBy>
<TableControl>
<TableHeaders>
<TableColumnHeader>
<Width>16</Width>
</TableColumnHeader>
<TableColumnHeader>
<Width>16</Width>
</TableColumnHeader>
<TableColumnHeader/>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
<TableColumnItems>
<TableColumnItem>
<PropertyName>ID</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Name</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>Department.Name</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>
</TableControl>
</View>
</ViewDefinitions>
</Configuration>
我已经在PS使用以下cmdlet注册我的XML文件
update-formatdata -prependpath c:\formatedoutput.ps1xml
它显示出表格放,它会显示员工ID和名称,但它不显示部门名称。
我认为它是因为它在嵌套的对象
任何人都可以请帮我在显示部门名称