techman
Guest
|
Posted:
Thu Aug 18, 2005 4:52 pm Post subject:
Invoking pipelines using OrderPipeline.Execute() |
|
|
Hi,
I am trying to invoke a pipeline using the OrderPipeline.Execute() method. I
am getting the following exception:
InvalidCastException: Specified cast is not valid.]
Microsoft.CommerceServer.Runtime.Pipelines.OrderPipeline.Execute(Object
order, Object context) +108
Is this a proper approach for invoking a pipeline? If so, can someone
provide me details about the arguments passed to this method, especially the
'context' argument?
Thanks |
|
Colin Bowern
Guest
|
Posted:
Fri Aug 19, 2005 4:52 pm Post subject:
Re: Invoking pipelines using OrderPipeline.Execute() |
|
|
Hi,
What sort of pipeline are you trying to execute? Are you executing inside
an ASP.NET application context? I use the following helper function to
execute pipelines against baskets as an example:
private void RunPipeline(string pipelineName)
{
PipelineInfo pipeInfo;
CommerceContext commerceContext = CommerceContext.Current;
pipeInfo = new PipelineInfo(pipelineName);
// Set pipeline object references
pipeInfo[PipelineFields.CatalogLanguage] =
Thread.CurrentThread.CurrentUICulture.Name;
pipeInfo.CatalogContext = commerceContext.CatalogSystem;
pipeInfo.ProfileContext = commerceContext.ProfileSystem;
pipeInfo.Language = Thread.CurrentThread.CurrentUICulture.Name;
// Attach the user profile to the pipeline.
pipeInfo.Profiles.Add("User", commerceContext.UserProfile);
// If it exists attach the targeting context profile.
if (commerceContext.TargetingSystem.TargetingContextProfile != null)
pipeInfo.Profiles.Add("TargetingContext",
commerceContext.TargetingSystem.TargetingContextProfile);
// Run pipeline
try
{
this.currentBasket.RunPipeline(pipeInfo);
}
catch (CommerceOrderSystemException ex)
{
ExceptionManager.Publish(ex);
if( (((SimpleList)this.orderForm[OrderFormFields.BasketErrors]).Count ==
0) &&
(((SimpleList)this.orderForm[OrderFormFields.PurchaseErrors]).Count ==
0) )
this.AddPurchaseError(StringResources.GetString(StringResourceKeys.Checkout_SystemError));
}
// Populate basket error collection
this.basketErrors.Clear();
foreach (object item in
(SimpleList)this.orderForm[OrderFormFields.BasketErrors])
this.AddBasketError((string)item);
// Populate purchase error collection
this.purchaseErrors.Clear();
foreach (object item in
(SimpleList)this.orderForm[OrderFormFields.PurchaseErrors])
this.AddPurchaseError((string)item);
}
"techman" <techman@discussions.microsoft.com> wrote in message
news:36401F79-8016-4252-BAB8-D017A739CB7E@microsoft.com...
| Quote: | Hi,
I am trying to invoke a pipeline using the OrderPipeline.Execute() method.
I
am getting the following exception:
InvalidCastException: Specified cast is not valid.]
Microsoft.CommerceServer.Runtime.Pipelines.OrderPipeline.Execute(Object
order, Object context) +108
Is this a proper approach for invoking a pipeline? If so, can someone
provide me details about the arguments passed to this method, especially
the
'context' argument?
Thanks |
|
|