开发者

Wix: Passing an object from one CustomAction method to another - Best Practice?

I am interested in the best practice of the following scenario. I have a CustomAction me开发者_运维百科thod that hits a web service and returns some information that I use to populate a combo box. Later in the install process in another CustomAction method, I need to access some of the meta data returned from that first web service call.

In the first method, I create a List that is a public static member of my CustomAction class. In my second method when I access the list its empty.

My thoughts were to serialize it using xaml serialization into a session variable then deserialize it in my second method.

Am I way off here? Is there a better way?


I will assume that your second custom action is making configuration changes to the machine and running in the execute sequence as deferred with no impersonation. This means it can only access the CustomActionData property.

This means your first custom action will have to serialize the CustomActionData property for the second one to deserialize. Now the CustomActionData is a Key:Value collection and what you do with it ( including have a Key with a Value that is yet another serialized datatype ) is completely up to you.

Be sure to read the DTF documentation to understand how to use the CustomActionData type and members off the Session class to your advantage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜