Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConfigureServiceApiBlock.cs" company="Sitecore Corporation">
// Copyright (c) Sitecore Corporation 1999-2017
// </copyright>
// <summary>
// ConfigureServiceApiBlock pipeline block.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Sitecore.Commerce.Plugin.Reporting.Pipelines.Blocks
{
using System.Threading.Tasks;
using Microsoft.AspNetCore.OData.Builder;
using Sitecore.Commerce.Core;
using Sitecore.Framework.Conditions;
using Sitecore.Framework.Pipelines;
using Model;
/// <summary>
/// The process orders minion block.
/// </summary>
public class ConfigureServiceApiBlock : PipelineBlock<ODataConventionModelBuilder, ODataConventionModelBuilder, CommercePipelineExecutionContext>
{
/// <summary>
/// The _pipeline.
/// </summary>
private readonly IPersistEntityPipeline _pipeline;
public ConfigureServiceApiBlock(IPersistEntityPipeline persistEntityPipeline)
{
this._pipeline = persistEntityPipeline;
}
public override Task<ODataConventionModelBuilder> Run(ODataConventionModelBuilder modelBuilder, CommercePipelineExecutionContext context)
{
Condition.Requires(modelBuilder).IsNotNull($"{base.Name}: The argument can not be null");
modelBuilder.EntitySet<OrderLine>("OrderLines");
modelBuilder.EntitySet<OrderCoupon>("OrderCoupons");
modelBuilder.EntitySet<OrderDiscountAdjustment>("OrderDiscountAdjustments");//.EntityType.HasKey(x => x.OrderDiscountAdjustmentId);
return Task.FromResult(modelBuilder);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment