private void GetWorkerRoleCSDEFTemplate(string workerRoleName, ref int workerRoleOccurrence, out WorkerRole workerRole)
 {
     XmlSerializer xmlSerializer = new XmlSerializer(typeof(ServiceDefinition));
     Assembly assembly = Assembly.GetExecutingAssembly();
     Stream stream = assembly.GetManifestResourceStream(ResourceName.slaveWorkerRoleCSDEFTemplate);
     workerRole = ((ServiceDefinition)xmlSerializer.Deserialize(stream)).WorkerRole[0];
     stream.Close();
     workerRole.name = workerRoleName;
     workerRoleOccurrence++;
 }
        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;
        }