private static void AddCasingStrategy(this IServiceCollection services, JsonCrafterCasing casing) { switch (casing) { case JsonCrafterCasing.CamelCase: services.AddSingleton <ICaseFormatter, CamelCaseFormatter>(); break; case JsonCrafterCasing.PascalCase: services.AddSingleton <ICaseFormatter, PascalCaseFormatter>(); break; case JsonCrafterCasing.SnakeCase: services.AddSingleton <ICaseFormatter, SnakeCaseFormatter>(); break; case JsonCrafterCasing.ParamCase: services.AddSingleton <ICaseFormatter, ParamCaseFormatter>(); break; default: throw new JsonCrafterException($"Could not activate casing strategy '{casing.ToString()}' (not supported)"); } }
public void SetCasing(JsonCrafterCasing format) { _casingFormat = format; }