Best location for Fluent IOC configuration/Modules (Currently trying Ninject)

前端 未结 4 1301
清歌不尽
清歌不尽 2021-01-05 16:37

I am struggling to find the best place to locate my Ninject configuration \"Modules\" (the place where Type bindings are specified). I hope I am just missing some obvious tr

4条回答
  •  失恋的感觉
    2021-01-05 17:24

    I typically create an assembly just for the IOC Container and configuration; That Assembly can then reference all of the other Assemblies and Ninject (or StructureMap in my case). Then the web application just has to reference the IOC assembly and include a couple lines of initialization code that directly use the IOC assembly.

    One note however - My IOC assembly does not reference the web assembly (that would introduce a circular reference). Anything that needs to be injected is defined outside of the web assembly, so this is not a concern for me.

提交回复
热议问题