Web.config Level => pages maintainScrollPositionOnPostBack ="true"/>
Page Level => <%@ Page MaintainScrollPositionOnPostback ="true"%>
Code Level => Page.MaintainScrollPositionOnPostBack = true;
Browser Level => browser id ="Chrome"parentID ="Safari1Plus"> capabilities> capability name ="supportsMaintainScrollPositionOnPostback"value ="true"/> capabilities> browser>
上面提到的4种方式中的任何一种都不适用于谷歌浏览器.它与firefox一起正常工作.请提供任何解决方案.
当以下 POCO 类的“Salary”字段的十进制值为 12000M(十进制值)时,Swagger UI 将 JSON 属性值显示为 12000。而预期的 JSON 属性值为 12000.0(即尾随零)。
在startup.cs的“ConfigureServices(IServiceCollection services)”方法中使用以下代码:
services.AddControllers().AddNewtonsoftJson(options =>
{
options.SerializerSettings.FloatParseHandling = FloatParseHandling.Decimal;
options.SerializerSettings.FloatFormatHandling = FloatFormatHandling.DefaultValue;
});
services.AddControllersWithViews().AddNewtonsoftJson(options =>
{
options.SerializerSettings.FloatParseHandling = FloatParseHandling.Decimal;
options.SerializerSettings.FloatFormatHandling = FloatFormatHandling.DefaultValue;
});
Run Code Online (Sandbox Code Playgroud)
还使用了以下代码片段,但 Swagger UI 中没有出现预期的输出。(在 Swashbuckle.AspNetCore.Newtonsoft V6.1.4.0 中)
services.AddAwaggerGenNewtonsoftSupport();
Run Code Online (Sandbox Code Playgroud)
当上面的代码片段不起作用时,也尝试以下。但没有运气。
services.AddMvc().AddNewtonsoftJson(options =>
{
options.SerializerSettings.FloatParseHandling = FloatParseHandling.Decimal;
options.SerializerSettings.FloatFormatHandling = FloatFormatHandling.DefaultValue;
});
Run Code Online (Sandbox Code Playgroud)
班级:
public class Employee{
public string EmployeeName {get; set;}
public decimal Salary {get; set;}
public string Department {get; set;}
}
Run Code Online (Sandbox Code Playgroud)
看起来,即使添加上述代码片段后,Swagger UI 也没有使用 Newtonsoft.Json 来序列化十进制,而是使用 …
jsonserializer json.net swagger-ui asp.net-core system.text.json