/// <summary> /// Creates a new Job, allowing the service to generate a job id. Use /// CreateOrUpdate if a user-chosen job id is required. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations. /// </param> /// <param name='parameters'> /// Required. Parameters specifying the job definition for a Create Job /// operation. /// </param> /// <returns> /// The Create Job operation response. /// </returns> public static JobCreateResponse Create(this IJobOperations operations, JobCreateParameters parameters) { return Task.Factory.StartNew((object s) => { return ((IJobOperations)s).CreateAsync(parameters); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Creates a new Job, allowing the service to generate a job id. Use /// CreateOrUpdate if a user-chosen job id is required. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations. /// </param> /// <param name='parameters'> /// Parameters specifying the job definition for a Create Job operation. /// </param> /// <returns> /// The Create Job operation response. /// </returns> public static JobCreateResponse Create(this IJobOperations operations, JobCreateParameters parameters) { try { return operations.CreateAsync(parameters).Result; } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// Creates a new Job, allowing the service to generate a job id. Use /// CreateOrUpdate if a user-chosen job id is required. /// </summary> /// <param name='operations'> /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations. /// </param> /// <param name='parameters'> /// Required. Parameters specifying the job definition for a Create Job /// operation. /// </param> /// <returns> /// The Create Job operation response. /// </returns> public static Task<JobCreateResponse> CreateAsync(this IJobOperations operations, JobCreateParameters parameters) { return operations.CreateAsync(parameters, CancellationToken.None); }