Ninject中解决方案的宽依赖性解决方案

时间:2014-07-22 13:14:26

标签: c# ninject

是否可以在Ninject或任何其他DI框架中启用解决方案范围的依赖关系解决方案?

例如,

// different project, in the same solution :- ProjectLogging
namespace LogProject {
   public class Logger {
      [Inject]
      public ILogImplementation LogImplementation {get;set;}

      public void Log(string log, params object[] args){
        // .. implementation skipped
      }
    }
}

// in a different project, in the same solution:- ProjectA
namespace MainProject {
    public class Product {
         public static void Main(string[] args){
            new Logger().Log("Hello");
            // some magic here.. 
            var kernel = new StandardKernel(new Bindings());
         }
    }
}

0 个答案:

没有答案