2012-02-04 10 views
9

でインストーラを見つけることができません:私は、Global.asaxのをデバッグするとき城ウィンザーは私global.axaxでコードを持っているアセンブリ

protected void Application_Start() 
{ 
    WindsorContainer = new WindsorContainer(); 
    WindsorContainer.Install(FromAssembly.InDirectory(new AssemblyFilter(AppDomain.CurrentDomain.RelativeSearchPath))); 
    ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(WindsorContainer.Kernel)); 
//... 
} 

は、コードFromAssembly.InDirectory(newAssemblyFilter(AppDomain.CurrentDomain.RelativeSearchPath))が検出したすべての私のプロジェクトのDLLの(7 DLLのがあります)。それらの 3例えばIWindsorInstallerインターフェイスの実装が含まれます

class WindsorInstaller : IWindsorInstaller 
{ 
    public void Install(IWindsorContainer container, IConfigurationStore store) 
    { 
     var services = AllTypes.FromThisAssembly().Where(type => type.Name.EndsWith("Service")); 
     container.Register(services 
      .WithService.DefaultInterfaces() 
      .Configure(c => c.LifestyleTransient())); 
     container.Register(Component.For<ISession>().ImplementedBy<AspnetSession>(). 
      LifeStyle.Transient); 
     container.Register(Component.For<ICache>().ImplementedBy<AspnetCache>(). 
      LifeStyle.Transient); 
    } 
} 

をしかし、私はブレークポイントを設定したときに、それが呼ばれる唯一の1インストーラで、他の2はスキップされました。 面白いですが、私は別のの私のコピーしたコードからのプロジェクトを持っています。

答えて

14

インストーラのクラスは公開する必要があります。現在のインストーラクラスにはアクセス修飾子がないため、デフォルトでinternalに設定されており、ウィンザーには見えません。キャッスルのドキュメントでこれを指定します:http://stw.castleproject.org/Windsor.Installers.ashx

+0

ああ私の神!それはとても愚かな間違い:)ビッグ感謝! –

+4

私たちのすべてに起こる、すべての時間:) – Marijn

関連する問題