我正在尝试根据SdkMessageProcessingStepImageId的值选择SdkMessageProcessingStepId属性,请参阅下面的xml,但我很挣扎。
<SdkMessageProcessingStep Name="Plugins.OnPreCreateUpdateCar: Update of new_car" SdkMessageProcessingStepId="{00c19595-76fd-e111-9528-005056af005a}">
<PluginTypeName>Plugins.OnPreCreateUpdateCar, Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f59c17e3653dba0</PluginTypeName>
<PrimaryEntity>new_car</PrimaryEntity>
<AsyncAutoDelete>0</AsyncAutoDelete>
<InvocationSource>1</InvocationSource>
<Mode>0</Mode>
<Rank>1</Rank>
<SdkMessageId>{20bebb1b-ea3e-db11-86a7-000a3a5473e8}</SdkMessageId>
<EventHandlerTypeCode>4602</EventHandlerTypeCode>
<Stage>20</Stage>
<IsCustomizable>1</IsCustomizable>
<IsHidden>0</IsHidden>
<SupportedDeployment>0</SupportedDeployment>
<SdkMessageProcessingStepImages>
<SdkMessageProcessingStepImage Name="PreImageCar">
<SdkMessageProcessingStepImageId>{e3c5bcb1-76fd-e111-9528-005056af005a}</SdkMessageProcessingStepImageId>
<EntityAlias>PreImageCar</EntityAlias>
<ImageType>0</ImageType>
<MessagePropertyName>Target</MessagePropertyName>
<IsCustomizable>1</IsCustomizable>
</SdkMessageProcessingStepImage>
</SdkMessageProcessingStepImages>
</SdkMessageProcessingStep>
我尝试过各种各样的事情,例如两个查询,连接但似乎没有任何工作。最后,我选择了一个完全不同的解决方案,但在一个查询中知道如何执行此操作会很方便。
TIA
答案 0 :(得分:1)
我不确定你想要实现的目标。但也许这会有所帮助:
XElement xmlTree = XElement.Load(source);
string[] result = xmlTree.Descendants("SdkMessageProcessingStepImageId")
.Where(element => element.Value == "{e3c5bcb1-76fd-e111-9528-005056af005a}")
.Select(element => element.Parent.Parent.Parent)
.Attributes()
.Where(attribute => attribute.Name == "SdkMessageProcessingStepId")
.Select(attribute => attribute.Value)
.ToArray();
结果:
{00c19595-76fd-e111-9528-005056af005a}