Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
namespace Sitecore.Services.Examples.Indexing
{
using System;
using System.Threading.Tasks;
using Sitecore.Commerce.Core;
using Sitecore.Commerce.Core.Commands;
using Sitecore.Commerce.Plugin.Sample;
public class GenerateFacetsCommand : CommerceCommand
{
private readonly IGenerateFacetsPipeline _pipeline;
public GenerateFacetsCommand(IGenerateFacetsPipeline pipeline, IServiceProvider serviceProvider) : base(serviceProvider)
{
this._pipeline = pipeline;
}
public async Task<bool> Process(CommerceContext commerceContext, string catalogId)
{
using (var activity = CommandActivity.Start(commerceContext, this))
{
var arg = new GenerateFacetsArgument(catalogId);
var result = await this._pipeline.Run(arg, new CommercePipelineExecutionContextOptions(commerceContext));
return result;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment