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
|
/// Extends the builder to allow for configuring the temporal
|
||||||
/// settings for generation.
|
/// settings for generation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="builder">The host builder being configured.</param>
|
public static NitrideBuilder UseTemporal(this NitrideBuilder builder, Action<Timekeeper>? configure = null)
|
||||||
/// <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)
|
|
||||||
{
|
{
|
||||||
return builder.UseTemporal()
|
builder.ConfigureContainer(x => x.RegisterModule<NitrideTemporalModule>());
|
||||||
.ConfigureSite(
|
|
||||||
(_, scope) =>
|
|
||||||
{
|
|
||||||
Timekeeper? clock = scope.Resolve<Timekeeper>();
|
|
||||||
callback(clock);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NitrideBuilder UseTemporal(this NitrideBuilder builder)
|
if (configure != null)
|
||||||
{
|
{
|
||||||
return builder.ConfigureContainer(x => x.RegisterModule<NitrideTemporalModule>());
|
builder.ConfigureSite((_, scope) => configure(scope.Resolve<Timekeeper>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -9,6 +9,7 @@ public class NitrideTemporalModule : Module
|
||||||
{
|
{
|
||||||
builder.RegisterOperators(this);
|
builder.RegisterOperators(this);
|
||||||
builder.RegisterValidators(this);
|
builder.RegisterValidators(this);
|
||||||
|
builder.RegisterType<Timekeeper>().AsSelf().SingleInstance();
|
||||||
builder.RegisterGeneric(typeof(SetInstantFromComponent<>)).As(typeof(SetInstantFromComponent<>));
|
builder.RegisterGeneric(typeof(SetInstantFromComponent<>)).As(typeof(SetInstantFromComponent<>));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue