using System.Collections.Immutable; using System.Reflection; using Connected.Annotations; namespace Connected.Configuration.Environment; internal class EnvironmentService : IEnvironmentService { private List? _assemblies; public List All => _assemblies ??= QueryAssemblies(); public EnvironmentService() { Services = new EnvironmentServices(); } public ImmutableList MicroServices => All.ToImmutableList(); public IEnvironmentServices Services { get; } private static List QueryAssemblies() { var result = new List(); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { if (assembly.GetCustomAttribute() is not null) result.Add(assembly); } return result; } }