Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions src/Benchmark/TestAdaptHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,13 @@ public static Foo SetupFooInstance()

private static void SetupCompiler(MapsterCompilerType type)
{
switch (type)
TypeAdapterConfig.GlobalSettings.Compiler = type switch
{
case MapsterCompilerType.Default:
TypeAdapterConfig.GlobalSettings.Compiler = _defaultCompiler;
break;
case MapsterCompilerType.Roslyn:
TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileWithDebugInfo();
break;
case MapsterCompilerType.FEC:
TypeAdapterConfig.GlobalSettings.Compiler = exp => exp.CompileFast();
break;
default:
throw new ArgumentOutOfRangeException(nameof(type));
}
MapsterCompilerType.Default => _defaultCompiler,
MapsterCompilerType.Roslyn => exp => exp.CompileWithDebugInfo(),
MapsterCompilerType.FEC => exp => exp.CompileFast(),
_ => throw new ArgumentOutOfRangeException(nameof(type)),
};
}
public static void ConfigureMapster(Foo fooInstance, MapsterCompilerType type)
{
Expand Down