Merge pull request #3956 from sbwalker/dev

add IClientService support to .NET MAUI
This commit is contained in:
Shaun Walker 2024-03-05 11:52:40 -05:00 committed by GitHub
commit aa3325ef35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -255,6 +255,16 @@ public static class MauiProgram
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
{