Forums: Open Discussion (Thread #28363)

MappingInfoを指定したデータコピーについて (2011-01-07 17:17 by tori #55155)

コンプレックスタイプのコレクションについて,要素単位でコピーを行いたいです。
また,要素単位にMappingInfoでコピー先を指定する必要がありますが,試した限りでは行えませんでした。

一つのコレクションデータに対して,複数要素をマッピングすることはできますか?

【コピー元データ】
dataList As List(Of Data)
-------------
Class Data
property Prop1 as String
property Prop2 as String
-------------

【コピー先データ】
sampleList as List(Of Sample)
--------------
Class Sample
property Sample1 as String
property Sample2 as String
--------------

この条件の元,MappingInfoを指定すると,以下のような結果となりました。

(1)OKパターン1
・dataList[].Prop1 -> sampleList[].Sample1
dataListのProp1が全てsampleListのSample1にコピーされる。

(2)OKパターン2
・dataList[].Prop2 -> sampleList[].Sample2
dataListのProp2が全てsampleListのSample2にコピーされる。

(3)NGパターン
・dataList[].Prop1 -> sampleList[].Sample1
・dataList[].Prop2 -> sampleList[].Sample2
dataListの件数分sampleListは作成されるが,
Sample1, Sample2ともにデータがコピーされていない。

※なお,上記は全て画面遷移のFormForwarderのForwardMappingに対して設定しています。

Reply to #55155×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login