Share via


CommerceDelete

This operation is used to delete existing commerce entities.

Note: To delete related items or relationships of a commerce entity, use the CommerceUpdate operation.

Dd327867.94cbdb0e-782c-45d4-8a7e-21e595ebe3ee(en-US,CS.90).gif

Class

Description

CommerceOperation

Base class of every operation.

PropertyDescription
ModelThis property represents the commerce entity of the operation.
RelatedOperationsThis list is not used by this operation. It is assumed the deletion of a commerce entity deletes all of the relationships.

CommerceDeleteOperation

Concrete delete operation class.

PropertyDescription
SearchCriteriaThis property specifies the commerce entity being deleted.

CommerceDeleteOptions

Options for the delete operation.

PropertyDescription
ReturnDeletedCountThis property indicates the total number of deleted items is to be returned as part of the operation.

Restrictions

If the SearchCriteria type is not supported, the system will throw an exception.

Response

Running a CommerceCreateOperation request creates a CommerceCreateOperationResponse.

Dd327867.f023c2fc-dcfa-4ea5-a50e-741561602963(en-US,CS.90).gif

Property

Description

CommerceOperationResponse

Base class for every operation.

CommerceDeleteOperationResponse

Response of a DeleteOperation.

The Count indicates the number of items that were deleted and is returned only if the DeleteOptions.ReturnDeletedCount is set to True.

CommerceDelete<> Generic Class

The CommerceDelete<> generic class constructs a CommerceDeleteOperation operation or request to send to Microsoft Multi-Channel Commerce Foundation.

Dd327867.ee6fb0e3-8f0b-4019-b3a7-1010d9d89eeb(en-US,CS.90).gif

Class

Description

CommerceDelete<TItem, TSearch, TOption>

Generic class used to create a request for the CommerceDeleteOperation.

PropertyDescription
TItemThis item represents the commerce entity type (i.e. the Model) of the delete operation.
TSearchThis item represents the SearchCriteria type used to find the commerce entity.
TOptionThis item represents the type of CommerceDeleteOptions to be sent as part of the CommerceRequest.

CommerceDelete<TItem, TSearch>

Generic class used to create a request for the CommerceDeleteOperation.

PropertyDescription
TItemThis item represents the commerce entity type (i.e. the Model) of the delete operation.
TSearchThis item represents the SearchCriteria type used to find the commerce entity.

The DeleteOptions is defaulted to CommerceDeleteOptionsBuilder which represent the default CommerceDeleteOptions message.

CommerceDelete<TItem >

Generic class used to create a request for the CommerceDeleteOperation.

PropertyDescription
TItemThis item represents the commerce entity type (i.e. the Model) of the delete operation.

The CommerceSearchCriteria is defaulted to CommerceModelSearch of the model represented by TItem.

Example

The following example deletes a UserProfile from the Profiles System.

// Create a Delete<> object specifying the UserProfile commerce entity
// type as the type of commerce entity being deleted.
//
// The second parameter to the Delete<> indicates the type of search to employ.
// In this case the ModelSearch is used to specify the query information that 
// identifies the exact UserProfile to delete.
var deleteUser = new CommerceDelete<CommerceEntity>("UserProfile");

// Specify the Id of the user to delete.
deleteUser.SearchCriteria.Model.Id = "{D3112588-9387-4072-B82C-3A59A21B3D81}";

// Indicate the return count must be returned as part of the response.
deleteUser.Options.ReturnDeletedCount = true;

// Call the service by calling the ProcessRequest() message converting the
// Delete<> content in a Commerce Foundation request.
CommerceResponse response =
 OperationService.ProcessRequest(base.GetCurrentRequestContext(), deleteUser.ToRequest());

CommerceDeleteOperationResponse deleteResponse = response.OperationResponses[0]
    as CommerceDeleteOperationResponse;

Assert.Equals(deleteResponse.Count, 1);

See Also

Other Resources

Developing with the Multi-Channel Commerce Foundation

Commerce Foundation Operations