aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-10-18 21:51:47 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2023-10-18 21:51:47 -0400
commit95b30edb02b02ae66308bff88b4c9c50e4a3f31a (patch)
tree03a65939ae8ecf01a40b07448bc82eb3e8fbff64
parentb94ed4a3862c7fc909740c63aa55d54a7f399b68 (diff)
account and endpoint security updates
-rw-r--r--lib/VNLib.Plugins.Extensions.Loading/src/LoadingExtensions.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/VNLib.Plugins.Extensions.Loading/src/LoadingExtensions.cs b/lib/VNLib.Plugins.Extensions.Loading/src/LoadingExtensions.cs
index 3da015e..207aeed 100644
--- a/lib/VNLib.Plugins.Extensions.Loading/src/LoadingExtensions.cs
+++ b/lib/VNLib.Plugins.Extensions.Loading/src/LoadingExtensions.cs
@@ -30,6 +30,7 @@ using System.Reflection;
using System.Runtime.Loader;
using System.Threading.Tasks;
using System.Collections.Generic;
+using System.ComponentModel.Design;
using System.Runtime.CompilerServices;
using VNLib.Utils.Logging;
@@ -359,6 +360,21 @@ namespace VNLib.Plugins.Extensions.Loading
}
/// <summary>
+ /// Adds a service to the <see cref="IServiceContainer"/> using generics syntax
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="container"></param>
+ /// <param name="service">The service instance to add to the container</param>
+ /// <exception cref="ArgumentNullException"></exception>
+ public static void AddService<T>(this IServiceContainer container, T service)
+ {
+ _ = container ?? throw new ArgumentNullException(nameof(container));
+ _ = service ?? throw new ArgumentNullException(nameof(service));
+
+ container.AddService(typeof(T), service);
+ }
+
+ /// <summary>
/// <para>
/// Gets or inializes a singleton service of the desired type.
/// </para>