Commerce Foundation BasketGroup DeleteOperation
This Microsoft Commerce Server 2009 R2 operation is used to delete a BasketGroup object and its content. All related commerce entities will also be deleted; however, because commerce entities such as addresses and payment accounts are copies of user profile entities, they are removed from the Commerce Server Orders System, but not from the Profiles System.
This topic contains the following sections:
Syntax
Parameters
Operation Sequence Components
Return Value
Examples
Exceptions
Remarks
Syntax
var deleteBasketGroup = new CommerceDelete<CommerceEntity>("BasketGroup");
Parameters
Supports only CommerceModelSearch<BasketGroup>; however, supports only the following fields:
Fields |
Description |
---|---|
CommerceRequest.SearchCriteria.Model.UserId |
Required. Specifies the ID of the user associated with the BasketGroup to delete. |
CommerceRequest.SearchCriteria.Model.Id |
Specifies the ID associated with the BasketGroup entity to delete. Required if the Name is not specified. If both Nameand Id parameters are specified, the Id parameteris ignored. |
CommerceRequest.SearchCriteria.Model.BasketType |
Required. Specifies the type of basket to delete. The delete operation is performed on a BasketType with a value of "Cart" (0). |
CommerceRequest.SearchCriteria.Model.Name |
Specifies the name of the specific BasketGroup to delete. Required if the ID is not specified. If you specify both ID and Name, the IDparameter is ignored and the operation is performed based on the Name. |
Operation Sequence Components
Operation Sequence Component |
Description |
---|---|
BasketAuthorizationSequenceComponent |
Verifies if the current identity is authorized to perform this operation on this entity. |
BasketGroupLoader |
Loads the OrderGroup based on the request. |
BasketGroupCommitter |
Commits the changes to the BasketGroup. |
Return Value
This operation returns the number of items deleted.
Example
The following code sample shows how to use the CommerceDelete BasketGroup operation to delete a BasketGroup instance.
var delBasketGroup = new CommerceDelete<CommerceEntity, CommerceModelSearch<CommerceEntity>>("BasketGroup");
delBasketGroup.SearchCriteria.Model.Properties["Name"] = "Default";
delBasketGroup.SearchCriteria.Model.Properties["UserId"] = "{22FEEF65-8941-4488-BC57-5AC1E8792D10}";
delBasketGroup.SearchCriteria.Model.Properties["BasketType"] = 0;
Exceptions
Microsoft Multi-Channel Commerce Foundation can throw the following exception during this operation:
FaultException<GeneralOperationFault>- Indicates an operation has resulted in an internal exception being thrown. Details are logged in the event viewer.
FaultException<AuthorizationFault> - Exception thrown if the identity associated with the current request is not authorized to perform the operation.
Remarks
Supports only CommerceModelSearch. This operation can only be performed on BasketType with a type of "Cart" (0). You cannot delete a basketType that has a value of "order" (1). The required fields are UserId and either ID or Name. If both ID and Name are present in the request, the ID is ignored and the operation is performed based on the Name value. The use of any other fields in the query is not supported.
See Also
Other Resources
Commerce Foundation BasketGroup