I'm working on a simple REST api to Quartz using Nancy. I have a simple context class:
public class QuartzContext : IQuartzContext
{
public ISchedulerFactory Factory { get; protected set; }
public QuartzContext(ISchedulerFactory factory)
{
this.Factory = factory;
}
}
I'm registering an instance of the context into TinyIoC which I believe will be a singleton. Without this, the self-host fails to start due to dependency issues:
TinyIoCContainer.Current.Register<IQuartzContext>(
new NancyQuartzREST.QuartzWrapper.QuartzContext(new StdSchedulerFactory()));
I'm using this class which is a NancyModule
public partial class RESTApi : NancyModule
{
public RESTApi(IQuartzContext context) : base("/api")
{
this.SchedulerRoutes(context);
this.JobRoutes(context);
this.TriggerRoutes(context);
}
}
Upon starting the self-host server, I get a stackoverflow exception - why?