/// <summary> /// Executes the specified operation. /// </summary> /// <param name="operation">The operation.</param> /// <returns>The response instance.</returns> public static CommerceResponse Execute(CommerceBaseBuilder operation) { ParameterChecker.CheckForNull(operation, "operation"); if (operationServiceAgent == null) { operationServiceAgent = new OperationServiceAgent(); } return(operationServiceAgent.ProcessRequest( GetCurrentRequestContext(), operation.ToRequest())); }
static OperationServiceAgent GetServiceAgent() { if (serviceAgent == null) { lock (lockObject) // ensure object is only created once { if (serviceAgent == null) { serviceAgent = new CommerceServer.Foundation.OperationServiceAgent(); } } } return(serviceAgent); }
public Product GetProduct(string catalogName, string productId) { var query = new CommerceQuery <CommerceEntity>("Product"); query.SearchCriteria.Model.SetPropertyValue("CatalogId", catalogName); query.SearchCriteria.Model.SetPropertyValue("Id", productId); var service = new OperationServiceAgent(); var response = service.ProcessRequestWithContext(query.ToRequest()); return (new Mapper().Map <Product>( response .OperationResponses.OfType <CommerceQueryOperationResponse>() .Single().CommerceEntities.Single())); }