I want to migrate the AddCsvSerializerFormatters configuration to .NET Core 3.0
Taken from the example code here
services.AddMvc(o =>
{
...
})
.AddCsvSerializerFormatters()
A .NET Core 3.0 web api project registers just the controllers, and registering all of Mvc seems overkill.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
...
}
References:
The ServiceCollection.AddControllers()
returns an IMvcBuilder
type. Since this package adds an extension AddCsvSerializerFormatters()
for IMvcBuilder
, you can chain the method invocation by:
services.AddControllers().AddCsvSerializerFormatters();
See AddCsvSerializerFormatters():
public static IMvcBuilder AddCsvSerializerFormatters(this IMvcBuilder builder)