Core - Refactor service registration

This commit is contained in:
Robert committed 2023-02-04 23:25:48 +01:00
1 parent a1086df41a
commit f2ef657d00
18 files changed
+234 -231

No files matched your search

@@ -0,0 +1,21 @@
using System.Reflection;
using Artemis.UI.Shared.Services;
using DryIoc;
namespace Artemis.UI.Shared.DryIoc;
/// <summary>
/// Provides an extension method to register services onto a DryIoc <see cref="IContainer"/>.
/// </summary>
public static class UIContainerExtensions
{
/// <summary>
/// Registers shared UI services into the container.
/// </summary>
/// <param name="container">The builder building the current container</param>
public static void RegisterSharedUI(this IContainer container)
{
Assembly artemisShared = typeof(IArtemisSharedUIService).GetAssembly();
container.RegisterMany(new[] { artemisShared }, type => type.IsAssignableTo<IArtemisSharedUIService>(), Reuse.Singleton);
}
}
@@ -1,19 +0,0 @@
using System.Reflection;
using Artemis.Core.DryIoc;
using Artemis.UI.Shared.Services;
using DryIoc;
namespace Artemis.UI.Shared.DryIoc;
/// <summary>
/// The main <see cref="IModule" /> of the Artemis Shared UI toolkit that binds all services
/// </summary>
public class SharedUIModule : IModule
{
/// <inheritdoc />
public void Load(IRegistrator builder)
{
Assembly artemisShared = typeof(IArtemisSharedUIService).GetAssembly();
builder.RegisterMany(new[] { artemisShared }, type => type.IsAssignableTo<IArtemisSharedUIService>(), Reuse.Singleton);
}
}