Hello all,

I am writing my first complex setup using wix and managed custom actions
using c#.

During the setup the user enters some settings. I have created an
immediate customaction which saves those settings as rows in a
CustomTable when the user clicks next.
When I debug this customaction it seems to me that the records are
successfully saved.

I have scheduled an immediate customaction after InstallFiles which
should read this customtable and schedule customactions as deferred,
callback, commit with the data from this customtable as CustomData using
the CustomData class.
However, when this immediate custom action executes it retrieves no rows
from the custom table.
I save the records using InsertTemporary as I cannot use Insert and have
read that this should not be possible during the installation process.

Below is the code used to write the entries and read it afterwards.

                View msmqView = GetMsmqTable(session);

                Record rec = new Record(7);
                rec[1] = messageQueueName;
                rec[2] = create;
                rec[3] = assign;
                rec[4] = exists ? 1 : 0;
                rec[5] = string.IsNullOrEmpty(user1) ? null : user1;
                rec[6] = string.IsNullOrEmpty(user2) ? null : user2;
                msmqView.Modify(ViewModifyMode.InsertTemporary, rec);

My helper function GetMsmqTable is very simple:
        private static View GetMsmqTable(Session session)
        {
            View msmqView = session.Database.OpenView("select * from
MsmqTable");
            return msmqView;
        }


In the InstallExecuteSequence I have scheduled one CustomAction
    <InstallExecuteSequence>
      <Custom Action="MsmqInitialize"
After="InstallFiles">&amp;MsmqFeature</Custom>
    </InstallExecuteSequence>

And the custom action is correctly started and executes:
                CustomActionData data = new CustomActionData();
                List<QueueModel> queues = ReadQueuesFromTable(session);
                if (queues.Count > 0)
                {
                    data.AddObject<List<QueueModel>>("Queues", queues);

                    // Schedule actions
                    session.DoAction("MsmqDeferred", data);
                    session.DoAction("MsmqCommit", data);
                    session.DoAction("MsmqRollback", data);
                }

But it doesn't schedule anything as it reads no rows in the
ReadQueuesFromTable method below:
        private static List<QueueModel> ReadQueuesFromTable(Session
session)
        {
            List<QueueModel> queues = new List<QueueModel>();
            View msmqView = GetMsmqTable(session);
            msmqView.Execute();
            Record rec = msmqView.Fetch();
            while (rec != null)
            {
                QueueModel model = new QueueModel();
                model.QueueName = (string)rec["QueueName"];
                model.CreateQueue = (int)rec["CreateQueue"];
                model.AssignUser = (int)rec["AssignPermissions"];
                model.DetectedExists = (int)rec["DetectedExists"];
                model.User1 = (string)rec["User1"];
                model.User2 = (string)rec["User2"];
                queues.Add(model);

                rec = msmqView.Fetch();
            }
            return queues;
        }
While debugging I have recognized that the Record first retrieved is
simply null.


What am I doing wrong? I expected this to work?

Thank you for your time

Kind Regards,
Jesper Balle

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to