コード例 #1
0
 private void GetWorkerRoleTemplate(string workerRoleName, ref int workerRoleOccurrence, out WorkerRole workerRole)
 {
     XmlSerializer xmlSerializer = new XmlSerializer(typeof(ServiceDefinition));
     Assembly assembly = Assembly.GetExecutingAssembly();
     Stream stream = assembly.GetManifestResourceStream(ResourceName.WorkerRoleTemplate);
     workerRole = ((ServiceDefinition)xmlSerializer.Deserialize(stream)).WorkerRole[0];
     stream.Close();
     workerRole.name = workerRoleName;
     workerRoleOccurrence++;
 }
コード例 #2
0
        private void AddNewWorkerRole(ServiceDefinition sd, WorkerRole newWorkerRole)
        {
            int count = (sd.WorkerRole == null) ? 0 : sd.WorkerRole.Length;
            WorkerRole[] workerRoles = new WorkerRole[count + 1];

            if (count > 0)
            {
                sd.WorkerRole.CopyTo(workerRoles, 0);
            }
            workerRoles[count] = newWorkerRole;
            sd.WorkerRole = workerRoles;
        }