假設我的例子實體TeamPlayer
看起來是這樣的:使用LINQ變換實體以XML
PlayerId PlayerName Team Position
----------------------------------------------
1 Nobody Team A Striker
1 Nobody Team B Center Midfield
1 Nobody Team C Substitute
2 Chuck Norris TeamA ALL
2 Chuck Norris TeamB Substitute
什麼,我試圖做到的,是寫一個C#方法,其中我通過玩家ID。結果應該是這樣的一個XML字符串(如果1被傳遞給方法):
<ns0:root xmlns:ns0="urn:teamsoftware:playermanager:playerovierview">
<player>
<playerid>1</playerid>
<playername>Nobody</playername>
<team>TeamA
TeamB
TeamC</team>
<position>Striker
Center Midfield
Substiture</position>
</player>
</ns0:root>
所以,如果一個玩家加入更多的球隊,他們應該是裏面<team>
標籤,通過CR LF分隔。我知道這是一個醜陋的解決方案,但數據被傳送到第三方工具,所以他們必須看起來像這樣不幸:/
任何幫助表示讚賞!
你有什麼到目前爲止編碼?我們可以幫助哪些部分? – Tikkes
那麼你有一些'列表'或類似的查詢這個數據? –