From 8059ba730690b667fa52fc8b17d58fa04f62ec8d Mon Sep 17 00:00:00 2001 From: sbwalker Date: Tue, 5 Mar 2024 11:52:27 -0500 Subject: [PATCH] add IClientService support to .NET MAUI --- Oqtane.Maui/MauiProgram.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Oqtane.Maui/MauiProgram.cs b/Oqtane.Maui/MauiProgram.cs index 3aded7f5..b07dfd3b 100644 --- a/Oqtane.Maui/MauiProgram.cs +++ b/Oqtane.Maui/MauiProgram.cs @@ -255,6 +255,16 @@ public static class MauiProgram services.AddScoped(serviceType ?? implementationType, implementationType); } } + + implementationTypes = assembly.GetInterfaces(); + foreach (var implementationType in implementationTypes) + { + if (implementationType.AssemblyQualifiedName != null) + { + var serviceType = Type.GetType(implementationType.AssemblyQualifiedName.Replace(implementationType.Name, $"I{implementationType.Name}")); + services.AddScoped(serviceType ?? implementationType, implementationType); + } + } } catch {