summaryrefslogtreecommitdiff
path: root/JPIF.cs
diff options
context:
space:
mode:
Diffstat (limited to 'JPIF.cs')
-rw-r--r--JPIF.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/JPIF.cs b/JPIF.cs
new file mode 100644
index 0000000..357c6d7
--- /dev/null
+++ b/JPIF.cs
@@ -0,0 +1,22 @@
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Formatters;
+using Microsoft.Extensions.Options;
+
+namespace BackendPIA {
+ public static class JPIF {
+ public static NewtonsoftJsonPatchInputFormatter GetJsonPatchInputFormatter() {
+ var builder = new ServiceCollection()
+ .AddLogging()
+ .AddMvc()
+ .AddNewtonsoftJson()
+ .Services.BuildServiceProvider();
+
+ return builder
+ .GetRequiredService<IOptions<MvcOptions>>()
+ .Value
+ .InputFormatters
+ .OfType<NewtonsoftJsonPatchInputFormatter>()
+ .First();
+ }
+ }
+} \ No newline at end of file