从.net RC2升级到RTM后,我发现需要为从ArrayPool派生的JsonOutputFormatter的构造函数提供参数.我如何获得此对象?我正在手动创建JsonOutputFormatter,因为我需要配置ReferenceLoopHandling.
我能找到的其他相关信息是这样的:
https://github.com/aspnet/Mvc/issues/4562
解决方法
@H_301_5@var formatter = new JsonOutputFormatter(formatterSettings,ArrayPool<Char>.Shared);
在评论中:
The JsonOutputFormatter now needs a ArrayPool when creating it,you
can pass in ArrayPool.Shared.
我还注意到ArrayPool上有一个.Create()方法.
@H_301_5@var formatter = new JsonOutputFormatter(formatterSettings,ArrayPool<Char>.Create());