DTF in WiX build 3.0.4123 adds a CustomActionData class.
Here's how it works... In your immediate CA, fill up a CustomActionData object
like this:
CustomActionData data = new CustomActionData();
data["Param1"] = String.Empty;
data["Param2"] = "Value2";
data["SomeOptionalParam"] = null;
It also accepts complex objects using XML serialization:
List<string> listData = new List<string>();
listData.Add("ListValue1");
listData.Add("ListValue2");
data.AddObject("MyListData", listData);
Call the deferred CA with the data:
session.DoAction(actionName, data);
The serialized data as seen in the MSI log will look like this:
Param1=;Param2=Value2;SomeOptionalParam;MyListData=<ArrayOfString><string>ListValue1</string><string>ListValue2</string></ArrayOfString>
Then retrieve it from within your deferred CA:
string value1 = session.CustomActionData["Param1"];
List<string> listData =
session.CustomActionData.GetObject<List<string>>("MyListData");
Beware that XML serialization has some limitations, for instance it doesn't
support IDictionary objects, and doesn't serialize non-public members. It works
best on simple collections or custom types that are specially designed to be
compatible with XML serialization. See the MSDN docs on XML serialization for
more information.
You can also nest CustomActionData objects. So if you're following the common
data-driven CA pattern where you have an immediate CA that iterates over the
rows in a table and sets up CustomActionData for each, then you can add data
for each record to the main CustomActionData object and do something like this
in the deferred CA:
foreach (CustomActionData data in session.CustomActionData.Values)
-Jason-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher
Painter
Sent: Wednesday, May 21, 2008 9:09 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] DTF - CustomActionData
I'm playing with DTF in the context of defferred CA's and I'm wondering in
broad general terms what might be the best way to handle passing data via
CustomActionData.
I'm trying to think beyond the standard /A=1 /B=2 /C=3 type serialization. An
obvious though is to create and pass some sort of serializable object but I
want to a) make sure I don't run into any sort of MSI Property passing
limitation and b) utilizie anything that might be in the DTF SDK to it's
fullest ability.
Anyone have any thoughts on this subject?
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users