mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Core - Refactor service registration
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user