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

前端 未结 2 1508
不知归路
不知归路 2020-12-18 19:35

Sorry in advance for the long question, it\'s long because I\'ve been digging at this all day.

The general problem:

I have an ASP.Net MVC2 application with

相关标签:
2条回答
  • 2020-12-18 20:04

    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.
    0 讨论(0)
  • 2020-12-18 20:27

    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.

    0 讨论(0)
提交回复
热议问题