DeleteAttributes() public method

Deletes one or more attributes associated with an item. If all attributes of the item are deleted, the item is deleted.

DeleteAttributes is an idempotent operation; running it multiple times on the same item or attribute does not result in an error response.

Because Amazon SimpleDB makes multiple copies of item data and uses an eventual consistency update model, performing a GetAttributes or Select operation (read) immediately after a DeleteAttributes or PutAttributes operation (write) might not return updated item data.

/// The specified attribute does not exist. /// /// The value for a parameter is invalid. /// /// The request must contain the specified missing parameter. /// /// The specified domain does not exist. ///
public DeleteAttributes ( DeleteAttributesRequest request ) : DeleteAttributesResponse
request DeleteAttributesRequest Container for the necessary parameters to execute the DeleteAttributes service method.
return DeleteAttributesResponse
Beispiel #1
0
        public void Put(string domainName, string itemName, bool isPublic, AmazonSimpleDBClient sdbClient)
        {
            if (String.IsNullOrEmpty(domainName) ||
                String.IsNullOrEmpty(itemName))
            {
                return;
            }

            DomainHelper.CheckForDomain(domainName, sdbClient);
            PutAttributesRequest putAttrRequest = new PutAttributesRequest().WithDomainName(domainName).WithItemName(itemName);
            putAttrRequest.WithAttribute(
                    new ReplaceableAttribute { Name = "Public", Value = isPublic.ToString(), Replace = true },
                    new ReplaceableAttribute { Name = "PhotoThumbUrl", Value = !String.IsNullOrEmpty(this.PhotoThumbUrl) ? this.PhotoThumbUrl : String.Empty, Replace = true },
                    new ReplaceableAttribute { Name = "Name", Value = this.Name, Replace = true },
                    new ReplaceableAttribute { Name = "Type", Value = this.Type, Replace = true },
                    new ReplaceableAttribute { Name = "Breed", Value = this.Breed, Replace = true },
                    new ReplaceableAttribute { Name = "Sex", Value = this.Sex, Replace = true },
                    new ReplaceableAttribute { Name = "Birthdate", Value = this.Birthdate, Replace = true },
                    new ReplaceableAttribute { Name = "Likes", Value = this.Likes, Replace = true },
                    new ReplaceableAttribute { Name = "Dislikes", Value = this.Dislikes, Replace = true }
                );
            sdbClient.PutAttributes(putAttrRequest);

            if (isPublic)
            {
                DomainHelper.CheckForDomain(Settings.Default.PetBoardPublicDomainName, sdbClient);
                putAttrRequest.DomainName = Settings.Default.PetBoardPublicDomainName;
                sdbClient.PutAttributes(putAttrRequest);
            }
            else
            {
                DeleteAttributesRequest deleteAttributeRequest = new DeleteAttributesRequest().WithDomainName(Settings.Default.PetBoardPublicDomainName).WithItemName(itemName);
                sdbClient.DeleteAttributes(deleteAttributeRequest);
            }
        }