Skip to content

Commit

Permalink
feature:
Browse files Browse the repository at this point in the history
优化代码命名方式
  • Loading branch information
KawhiWei committed Jul 16, 2024
1 parent 9428178 commit a9eeafd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ namespace Luck.Framework.PipelineAbstract;

public interface IDelegatePipelineBuilder<TContext> where TContext : IContext
{
// IDelegatePipelineBuilder<TContext> UseMiddleware<TMiddleware>(IDelegatePipe<TContext> delegatePipe) where TMiddleware;

IDelegatePipelineBuilder<TContext> UsePipe(IDelegatePipe<TContext> delegatePipe);

/// <summary>
///
/// </summary>
/// <returns></returns>
DelegatePipe<TContext> Build();
}
6 changes: 3 additions & 3 deletions src/framework/Luck.Pipeline/DelegatePipelineBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ public DelegatePipelineBuilder(IServiceProvider serviceProvider)

public IDelegatePipelineBuilder<TContext> UsePipe(IDelegatePipe<TContext> delegatePipe)
{
DelegatePipe<TContext> PipelineDelegate(DelegatePipe<TContext> next) =>
context => delegatePipe.InvokeAsync(context, next);

_pipes.Add(PipelineDelegate);
return this;

DelegatePipe<TContext> PipelineDelegate(DelegatePipe<TContext> next) =>
context => delegatePipe.InvokeAsync(context, next);
}

public DelegatePipe<TContext> Build()
Expand Down
1 change: 0 additions & 1 deletion test/Luck.UnitTest/Pipeline_Tests/PipelineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public void CreateDelegatePipelineFactory()
var createCustomerDelegatePipe = serviceProvider.GetService<CreateCustomerDelegatePipe>()!;
var cancelDelegatePipe = serviceProvider.GetService<CancelDelegatePipe>()!;


var customerContext = new CustomerContext(Guid.NewGuid().ToString());

var actuator = pipelineFactory.CreateDelegatePipelineBuilder<CustomerContext>()
Expand Down

0 comments on commit a9eeafd

Please sign in to comment.