add IClientService support to .NET MAUI

This commit is contained in:
sbwalker 2024-03-05 11:52:27 -05:00
parent f2555563a8
commit 8059ba7306

View File

@ -255,6 +255,16 @@ public static class MauiProgram
services.AddScoped(serviceType ?? implementationType, implementationType); services.AddScoped(serviceType ?? implementationType, implementationType);
} }
} }
implementationTypes = assembly.GetInterfaces<IClientService>();
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 catch
{ {