Commerce Foundation UserProfile CommerceQuery
This Commerce Server 2009 operation is used to retrieve a user profile object and any of its relationships.
Syntax
var queryUserProfile = new CommerceQuery<CommerceEntity>("UserProfile");
Parameters
At a minimum, the caller must specify the ID of the user profile to retrieve.
Operation Sequence Components
Operation Sequence Component |
Description |
---|---|
UserProfileLoader |
Retrieves the user profile from Commerce Server. Makes sure that the model search criteria includes search data, for example, ID or e-mail address. |
UserProfileAddressesProcessor |
Retrieves the addresses for the user from Commerce Server. |
UserProfileCreditCardsProcessor |
Retrieves the credit cards for the user from Commerce Server. |
UserProfileShippingMethodsProcessor |
Retrieves the shipping methods for the user from Commerce Server. |
UserProfileCacheRefreshProcessor |
Refreshes the cache or category of caches identified by the CommerceCacheName property. |
UserProfileResponseBuilder |
Converts the user profiles of the cached Commerce Server to Commerce Server 2009 user profiles and adds them to the response. |
UserProfileAddressResponseBuilder |
Converts Commerce Server addresses to Commerce Server 2009 addresses and adds them to the response. |
UserProfileCreditCardsResponseBuilder |
Converts Commerce Server credit cards to Commerce Server 2009 credit cards and adds them to the response. |
UserProfileShippingMethodsResponseBuilder |
Converts Commerce Server shipping methods to Commerce Server 2009 shipping methods and adds them to the response. |
Related Operations
Related Operation |
Description |
---|---|
CommerceQueryRelatedItem<Address>(Addresses) |
Retrieves all of the addresses associated with the user. This operation only supports the CommerceModelSearch<Address> search criteria, and the search Model must be empty. |
CommerceQueryRelatedItem<CreditCard>(CreditCards) |
Retrieves all of the credit cards associated with the user. This operation only supports the CommerceModelSearch<CreditCard> search criteria, and the search Model must be empty. |
CommerceQueryRelatedItem<PaymentMethod>(PaymentMethod) |
Retrieves the payment method associated with the credit card. This operation only supports the CommerceModelSearch<PaymentMethod> search criteria, and the search Model must be empty.
Note:
This must be a child of a CommerceQueryRelatedItem<CreditCard> operation.
|
CommerceQueryRelatedItem<Address>(PreferredAddress) |
Retrieves the preferred address of the user. This operation only supports the CommerceModelSearch<Address> search criteria, and the search mode must be empty. |
CommerceQueryRelatedItem<CreditCard>(PreferredCreditCard) |
Retrieves the preferred credit card of the user. This operation only supports the CommerceModelSearch<CreditCard> search criteria, and the search mode must be empty. |
CommerceQueryRelatedItem<PaymentMethod>(PreferredShippingMethod) |
Retrieves the preferred shipping method of the user. This operation only supports the CommerceModelSearch<ShippingMethod> search criteria, and the search mode must be empty. |
Valid Query Operations
Related Operation |
Description |
---|---|
SearchCriteria.Model.DateModified |
Used to enforce cache coherency in a web farm deployment. If the DateModified provided in the query is greater than the DateModified on the server, the UserProfile retrieved will be refreshed before being returned to the caller. It is the responsibility of the presentation layer to track the DateModified property of the UserProfile. This is typically done by putting the property value into a HTTP cookie. |
SearchCriteria.Model.Id |
ID of the user to retrieve. This property is required if Email is not specified. If both Email and Id are specified, an exception will be thrown. |
SearchCriteria.Model.Email |
E-mail address of the user to retrieve. This property is required if Id is not specified. If both Email and Id are specified, an exception will be thrown. |
Valid Related Query Operations
CommerceQueryRelatedItem<Address>(Addresses)
Related Operation Parameter |
Description |
---|---|
SearchCriteria.Model.Id |
When requesting the related address, the Id field may be populated or left blank. If left blank, all addresses for the user will be returned; otherwise, only the address with the specified Id will be returned. |
CommerceQueryRelatedItem<CreditCard>(CreditCards)
Related Operation Parameter |
Description |
---|---|
SearchCriteria.Model.Id |
When requesting the related credit cards, the Id field may be populated or left blank. If left blank, all credit cards for the user will be returned; otherwise, only the credit card with the specified Id will be returned. |
CommerceQueryRelatedItem<PaymentMethod>(PaymentMethods)
Related Operation Parameter |
Description |
---|---|
SearchCriteria.Id |
The search criteria for this operation must be emtpy. |
Return Value
This Commerce Server 2009 operation returns a CommerceQueryOperationResponse.
Exceptions
This operation does not throw any exceptions for Microsoft Multi-Channel Commerce Foundation to handle.
Remarks
This operation supports the CommerceModelSearch criteria mechanism only. If the profile item isn’t found, an exception will not be thrown; rather, the CommerceQueryOperationResponse item count will be 0 (zero). The caller should check this value before attempting to retrieve the commerce entity from the CommerceQueryOperationReponse object.
If the search criteria contains the last modified date, it will be evaluated against the retrieved user profile and if different, the Commerce Server Core Systems cache will be refreshed. UTC format should be used for time setting.
See Also
Other Resources
Developing with the Commerce Foundation Profiles System
Commerce Foundation User Profile
Commerce Foundation UserProfile CommerceCreate
Commerce Foundation UserProfile CommerceDelete