fix(temporal): fixing Autofac issues
This commit is contained in:
parent
7f3ae474f7
commit
fc0b016c3b
2 changed files with 9 additions and 15 deletions
|
@ -17,23 +17,16 @@ public static class NitrideTemporalBuilderExtensions
|
|||
/// Extends the builder to allow for configuring the temporal
|
||||
/// settings for generation.
|
||||
/// </summary>
|
||||
/// <param name="builder">The host builder being configured.</param>
|
||||
/// <param name="callback">The callback to configure the clock.</param>
|
||||
/// <returns>The builder passed in.</returns>
|
||||
public static NitrideBuilder ConfigureClock(this NitrideBuilder builder, Action<Timekeeper> callback)
|
||||
public static NitrideBuilder UseTemporal(this NitrideBuilder builder, Action<Timekeeper>? configure = null)
|
||||
{
|
||||
return builder.UseTemporal()
|
||||
.ConfigureSite(
|
||||
(_, scope) =>
|
||||
builder.ConfigureContainer(x => x.RegisterModule<NitrideTemporalModule>());
|
||||
|
||||
if (configure != null)
|
||||
{
|
||||
Timekeeper? clock = scope.Resolve<Timekeeper>();
|
||||
callback(clock);
|
||||
});
|
||||
builder.ConfigureSite((_, scope) => configure(scope.Resolve<Timekeeper>()));
|
||||
}
|
||||
|
||||
public static NitrideBuilder UseTemporal(this NitrideBuilder builder)
|
||||
{
|
||||
return builder.ConfigureContainer(x => x.RegisterModule<NitrideTemporalModule>());
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -9,6 +9,7 @@ public class NitrideTemporalModule : Module
|
|||
{
|
||||
builder.RegisterOperators(this);
|
||||
builder.RegisterValidators(this);
|
||||
builder.RegisterType<Timekeeper>().AsSelf().SingleInstance();
|
||||
builder.RegisterGeneric(typeof(SetInstantFromComponent<>)).As(typeof(SetInstantFromComponent<>));
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue