コード例 #1
0
 private static void ValidateEntityNull(JobHostEntity entity)
 {
     if (entity == null)
     {
         throw new ArgumentNullException("Parameter 'entity' cannot be null!", "entity");
     }
 }
コード例 #2
0
 private static void ValidateMandatoryParams(JobHostEntity entity)
 {
     if (string.IsNullOrEmpty(entity.Id))
     {
         throw new ArgumentException("Parameter 'entity.Id' cannot be null or empty for an update!");
     }
 }
コード例 #3
0
        public void UpdateJobHost(JobHostEntity entity)
        {
            // Parameter Validation
            ValidateEntityNull(entity);
            ValidateMandatoryParams(entity);

            // If the entity belongs to a different deploymet, throw an exception
            if (string.Compare(entity.DeploymentId, _deploymentId, true) != 0)
            {
                throw new InvalidOperationException("The entity you are trying to update must belong to the same deploymentId the repository has been created for!");
            }

            // Update or replace the entity
            var updateOp = TableOperation.InsertOrMerge(entity);

            _azureTable.Execute(updateOp);
        }
コード例 #4
0
        public JobHostEntity CreateJobHost(JobHostEntity entity)
        {
            // Parameter Validations
            ValidateEntityNull(entity);
            ValidateMandatoryParams(entity);

            // Every JobProcessor must be assigned to an appropriate deployment
            entity.DeploymentId = _deploymentId;

            // Next add the batch to the table
            var insertOp = TableOperation.Insert(entity);

            _azureTable.Execute(insertOp);

            // Return the entity with the updated ID
            return(entity);
        }