c# - NancyFx and TinyIoC provide single instance to module -
iv got simlpe question. im using nancy windows form (passed through constructor (autoresolve)). if let nancy resolve automatically every module creates new instance of form, not want. thought maybe register form instance in tinyioc , use instance instead of creating new 1 each time. has proved not simple implement idea is.
thanks in advance
you should in bootstrapper
something like:
public class mybootstrapper: defaultnancybootstrapper { configureapplicationcontainer (tinyioccontainer container) { //the .assingleton() instructs tinyioc make 1 of those. container.register<imessagedeliverer>().assingleton(); base.configureapplicationcontainer (container); } }
Comments
Post a Comment