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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -