servicestack,nodatime,funq,C#,servicestack,Nodatime,Funq" /> servicestack,nodatime,funq,C#,servicestack,Nodatime,Funq" />

C# 如何在ServiceStack中注册节点时间?

C# 如何在ServiceStack中注册节点时间?,c#,servicestack,nodatime,funq,C#,servicestack,Nodatime,Funq,我正在使用最新的ServiceStack,希望使用NodeTime而不是.NET DateTime类。我读过的建议显示了使用基于IClock的属性,我已经这样做了。现在我需要注入IClock,但我尝试的是无效的。我试过: container.RegisterAutoWiredAs<SystemClock, IClock>(); container.RegisterAutoWiredAs(); 但我收到异常“未找到'SystemClock'类型的构造函数” 我也试过了 contai

我正在使用最新的ServiceStack,希望使用NodeTime而不是.NET DateTime类。我读过的建议显示了使用基于IClock的属性,我已经这样做了。现在我需要注入IClock,但我尝试的是无效的。我试过:

container.RegisterAutoWiredAs<SystemClock, IClock>();
container.RegisterAutoWiredAs();
但我收到异常“未找到'SystemClock'类型的构造函数”

我也试过了

container.RegisterAutoWired<Instant>();
container.RegisterAutoWired();
编译,但不注入IClock


欢迎提供任何建议。

您应该能够向以下机构注册
IClock

container.Register<IClock>(c => SystemClock.Instance);
container.Register(c=>SystemClock.Instance);