From 3377cc6121aaa97bf2548eb8197b7e84ec93d70c Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 7 Jul 2025 15:36:48 +0200 Subject: [PATCH] =?UTF-8?q?feat(Client):=20statische=20Klasse=20zur=20Beha?= =?UTF-8?q?ndlung=20des=20Standarddienstanbieters=20mit=20=E2=80=9ELazy=20?= =?UTF-8?q?Loading=E2=80=9C=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Leanetec.EConnect.Client/Client.cs | 31 ++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/Leanetec.EConnect.Client/Client.cs diff --git a/src/Leanetec.EConnect.Client/Client.cs b/src/Leanetec.EConnect.Client/Client.cs new file mode 100644 index 0000000..e63447a --- /dev/null +++ b/src/Leanetec.EConnect.Client/Client.cs @@ -0,0 +1,31 @@ +using MediatR; +using Microsoft.Extensions.DependencyInjection; + +namespace Leanetec.EConnect.Client; + +/// +/// Provides a lazily initialized for accessing the EConnect client services, +/// including an instance for sending and publishing messages. +/// +public static class Client +{ + /// + /// Lazily initializes the that registers and builds the EConnect client services. + /// + private static readonly Lazy _serviceProvider = new(() => + { + var services = new ServiceCollection(); + services.AddEConnectClient(); + return services.BuildServiceProvider(); + }); + + /// + /// Gets the initialized that provides access to registered EConnect client services. + /// + public static IServiceProvider Provider => _serviceProvider.Value; + + /// + /// Gets the instance used for sending commands, queries, and publishing events within the EConnect client. + /// + public static IMediator Mediator => Provider.GetRequiredService(); +} \ No newline at end of file