feat: add InherentDependencyAttribute, mark PM inherently dependent on IM

This commit is contained in:
goat 2023-02-02 22:57:39 +01:00
parent 4a228f4e3b
commit f40ea4310c
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
5 changed files with 34 additions and 4 deletions

View file

@ -128,6 +128,11 @@ internal static class Service<T> where T : IServiceType
.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
.Select(x => x.FieldType)
.Where(x => x.GetCustomAttribute<ServiceManager.ServiceDependency>(true) != null));
res.AddRange(typeof(T)
.GetCustomAttributes()
.OfType<InherentDependencyAttribute>()
.Select(x => x.GetType().GetGenericArguments().First()));
return res
.Distinct()
.Select(x => typeof(Service<>).MakeGenericType(x))