zmjack/NStandard

pipe 无法完全替换then

Closed this issue · 2 comments

image

未升级前使用Then是好的,升级后感觉都变成以前的For 了

zmjack commented

参数函数拥有返回值时,会让它作为 Pipe 的返回值。

考虑使用以下方法让其返回 this

var builder = WebApplication.CreateBuilder(args)
    .Pipe(x => { x.Logging.AddSerilog(); });

或者

var builder = WebApplication.CreateBuilder(args)
    .Pipe<WebApplicationBuilder>(x => x.Logging.AddSerilog());

这样确实可以了,

非常感激!