How to use Ninject Conventions extension without referencing Assembly (or Types within it)

为君一笑 提交于 2019-11-29 09:11:47

This question was answerd on the mailing list. http://groups.google.com/group/ninject/browse_thread/thread/a7f2163e060a6d64

In Short:

  1. Form(path) takes a path either relative from the working directory or absolute
  2. The assembly must reside in a probing path as it is loaded into the load context to avoid other problems with switching the loading context.
  3. The development server makes all complicated as it copies all assemblies into their own directory, which makes it impossible to use the calling assembly to create the path. This means the only way for web apps using the development server.
  4. We will add support for full qualified names of assemblies in a future version to make this easier.

I'm not sure if this is a typo in your example, but I did notice that you've written

kernel.Scan(a => {
    a.From("MyApp.Data");
    // etc.
}

But shouldn't that be

kernel.Scan(a => {
    a.From("MyApp.Data.dll")
    // etc.
});

Because if I include the .dll part in my example project it works, but if I leave it out I receive a FileNotFoundException.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!