The FluentSerializer.Json.DependencyInjection.NetCoreDefault
library is responsible for registering the FluentSerializer for JSON using
Microsoft.Extensions.DependencyInjection.Abstractions.
For basic usage you can use this:
serviceCollection.AddFluentJsonSerializer<TAssemblyMarker>();
This will use the JsonSerializerConfiguration.Default
as the applied config.
The type parameter of TAssemblyMarker
will be used to scan that assembly for the profiles associated with this serializer.
Alternatively there are overloads that accept a System.Reflection.Assembly
variable.
There are multiple overloads, for changing configuration the lambda approach is recommended:
serviceCollection.AddFluentJsonSerializer<TAssemblyMarker>(static configuration =>
{
// Change configuration values
configuration.NewLine = LineEndings.LineFeed;
});
This will use a new instance of the JsonSerializerConfiguration
as the applied config and allows you to change some properties.
See the default values.