Created
November 18, 2019 04:09
-
-
Save brijbaroda/238de619ca60af5776172bc9cc8b11c0 to your computer and use it in GitHub Desktop.
Sitecore Commerce - Localizing Category - ConfigureServiceApiBlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -------------------------------------------------------------------------------------------------------------------- | |
// <copyright file="ConfigureServiceApiBlock.cs" company="Sitecore Corporation"> | |
// Copyright (c) Sitecore Corporation 1999-2017 | |
// </copyright> | |
// -------------------------------------------------------------------------------------------------------------------- | |
namespace POC.Localization | |
{ | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.OData.Builder; | |
using Sitecore.Commerce.Core; | |
using Sitecore.Commerce.Core.Commands; | |
using Sitecore.Framework.Conditions; | |
using Sitecore.Framework.Pipelines; | |
/// <summary> | |
/// Defines a block which configures the OData model | |
/// </summary> | |
/// <seealso> | |
/// <cref> | |
/// Sitecore.Framework.Pipelines.PipelineBlock{Microsoft.AspNetCore.OData.Builder.ODataConventionModelBuilder, | |
/// Microsoft.AspNetCore.OData.Builder.ODataConventionModelBuilder, | |
/// Sitecore.Commerce.Core.CommercePipelineExecutionContext} | |
/// </cref> | |
/// </seealso> | |
public class ConfigureServiceApiBlock : PipelineBlock<ODataConventionModelBuilder, ODataConventionModelBuilder, CommercePipelineExecutionContext> | |
{ | |
/// <summary> | |
/// The execute. | |
/// </summary> | |
/// <param name="modelBuilder"> | |
/// The argument. | |
/// </param> | |
/// <param name="context"> | |
/// The context. | |
/// </param> | |
/// <returns> | |
/// The <see cref="ODataConventionModelBuilder"/>. | |
/// </returns> | |
public override Task<ODataConventionModelBuilder> Run(ODataConventionModelBuilder modelBuilder, CommercePipelineExecutionContext context) | |
{ | |
Condition.Requires(modelBuilder).IsNotNull($"{this.Name}: The argument cannot be null."); | |
// Add unbound actions | |
var configuration = modelBuilder.Action("LocalizeCatalogItems"); configuration.ReturnsFromEntitySet<CommerceCommand>("Commands"); | |
return Task.FromResult(modelBuilder); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment