Files

35 lines
1.1 KiB
C#

#nullable enable
using System.Collections.Generic;
using ShrinkApp;
using ShrinkCommand.Integration.App;
using ShrinkContext;
using ShrinkContext.AppAdapter;
using ShrinkDataSaver.Integration.App;
using ShrinkNetwork.Integration.App;
namespace ShrinkApp.Starter.Basic;
public static class ShrinkBasicComposition
{
public static ShrinkContextAppHost CreateHost(ShrinkAppServices? services = null)
{
var host = new ShrinkContextAppHost(services);
host.Register<ShrinkCommandAppComponent>("shrink.command");
host.Register<ShrinkDataSaverAppComponent>("shrink.datasaver");
host.Register<ShrinkNetworkAppComponent>("shrink.network");
return host;
}
public static IReadOnlyList<ShrinkLoaderEntry> CreateEntries(ShrinkAppServices services,
ShrinkNetworkAppModuleConfig? network = null) => new[]
{
new ShrinkLoaderEntry("datasaver", "shrink.datasaver", services),
new ShrinkLoaderEntry("command", "shrink.command", services),
new ShrinkLoaderEntry("network", "shrink.network", network ?? new ShrinkNetworkAppModuleConfig
{
Services = services
})
};
}