Sau khi nâng cấp từ .net RC2 lên RTM, tôi thấy cần cung cấp một tham số cho một hàm tạo của JsonOutputFormatter có nguồn gốc từ ArrayPool. Làm thế nào để có được đối tượng này? Tôi đang newing JsonOutputFormatter bằng tay bởi vì tôi cần phải cấu hình ReferenceLoopHandling.Cung cấp đối tượng ArrayPool cho JsonOutputFormatter constructor
Chỉ thông tin liên quan khác tôi có thể tìm là: https://github.com/aspnet/Mvc/issues/4562
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMemoryCache();
services.AddSession();
services.AddMvc();
var formatterSettings = JsonSerializerSettingsProvider.CreateSerializerSettings();
formatterSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
JsonOutputFormatter formatter = new JsonOutputFormatter(formatterSettings, ???);
services.Configure<MvcOptions>(options =>
{
options.OutputFormatters.RemoveType<JsonOutputFormatter>();
options.OutputFormatters.Insert(0, formatter);
});
//etc...
}