From f0014d3d13ae4511dc5834a7419cd36cd95838e1 Mon Sep 17 00:00:00 2001
From: Niko Uusitalo <983351+nikouu@users.noreply.github.com>
Date: Mon, 14 Oct 2024 17:43:20 +1300
Subject: [PATCH] Added service registration extensions
---
src/ZeroRedact/Redactors/Redactor.Common.cs | 4 ++-
src/ZeroRedact/ZeroRedact.csproj | 6 +++-
src/ZeroRedact/ZeroRedactExtensions.cs | 35 +++++++++++++++++++++
3 files changed, 43 insertions(+), 2 deletions(-)
create mode 100644 src/ZeroRedact/ZeroRedactExtensions.cs
diff --git a/src/ZeroRedact/Redactors/Redactor.Common.cs b/src/ZeroRedact/Redactors/Redactor.Common.cs
index 3ead984..0c7a363 100644
--- a/src/ZeroRedact/Redactors/Redactor.Common.cs
+++ b/src/ZeroRedact/Redactors/Redactor.Common.cs
@@ -3,7 +3,9 @@
namespace ZeroRedact
{
- ///
+ ///
+ /// Implements redaction capabilities.
+ ///
[SkipLocalsInit]
public sealed partial class Redactor : IRedactor
{
diff --git a/src/ZeroRedact/ZeroRedact.csproj b/src/ZeroRedact/ZeroRedact.csproj
index 9ed3311..d182367 100644
--- a/src/ZeroRedact/ZeroRedact.csproj
+++ b/src/ZeroRedact/ZeroRedact.csproj
@@ -10,7 +10,7 @@
net8.0
Nikouu.ZeroRedact
- 2.2.0
+ 2.3.0-alpha
Nikouu.ZeroRedact
Niko Uusitalo
https://nikouu.github.io/ZeroRedact
@@ -49,4 +49,8 @@
<_Parameter1>ZeroRedact.Benchmark
+
+
+
+
diff --git a/src/ZeroRedact/ZeroRedactExtensions.cs b/src/ZeroRedact/ZeroRedactExtensions.cs
new file mode 100644
index 0000000..2a370b6
--- /dev/null
+++ b/src/ZeroRedact/ZeroRedactExtensions.cs
@@ -0,0 +1,35 @@
+using Microsoft.Extensions.DependencyInjection;
+
+namespace ZeroRedact
+{
+ ///
+ /// Extension methods for to register with the implementation.
+ ///
+ public static class ZeroRedactExtensions
+ {
+ ///
+ /// Registers an instance of with the implementation.
+ ///
+ /// The service collection
+ ///
+ public static IServiceCollection AddZeroRedact(this IServiceCollection services)
+ {
+ ArgumentNullException.ThrowIfNull(services);
+ services.AddSingleton();
+ return services;
+ }
+
+ ///
+ /// Registers an instance of with the implementation with .
+ ///
+ /// The service collection
+ /// The to configure the .
+ ///
+ public static IServiceCollection AddZeroRedact(this IServiceCollection services, RedactorOptions options)
+ {
+ ArgumentNullException.ThrowIfNull(services);
+ services.AddSingleton(new Redactor(options));
+ return services;
+ }
+ }
+}