mfgames-cil/src/MfGames.Nitride.Temporal/Setup/NitrideTemporalModule.cs
D. Moonfire d258e52697
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
fix: allow Nitride.Temporal to be used twice
2023-09-03 18:51:56 -05:00

36 lines
754 B
C#

using Autofac;
namespace MfGames.Nitride.Temporal.Setup;
public class NitrideTemporalModule : Module
{
private static bool loaded;
/// <inheritdoc />
protected override void Load(ContainerBuilder builder)
{
// Make sure our module isn't loaded more than once. This can happen
// if another module requires this one and the user adds this module
// to customize settings.
if (loaded)
{
return;
}
loaded = true;
// Make sure our module isn't loaded more than once.
builder.RegisterOperators(this);
builder.RegisterValidators(this);
builder
.RegisterType<TimeService>()
.AsSelf()
.SingleInstance();
builder
.RegisterGeneric(typeof(SetInstantFromComponent<>))
.As(typeof(SetInstantFromComponent<>));
}
}