2016-01-20 62 views
1

如果您安裝了StructureMap.MVC5 nuget包並更新了結構圖nuget包,則ControllerConvention類將要求您實施ScanTypes方法(從更新的IRegistrationConvention接口)。這是該方法的簽名:什麼時候將Structuremap.MVC5 nuget包更新爲支持Structuremap 4.x?

public void ScanTypes(TypeSet types, Registry registry) 

所以我的問題是,

  1. 會不會有一個更新版本的StructureMap.MVC5 NuGet包?
  2. 我該如何實施該方法?

謝謝。

+2

第一個問題是不適合於StackOverflow的 - 如果項目有一個bug跟蹤系統,你應該尋找關於這個問題有沒有票。 –

回答

7

基於查爾斯·達菲的響應,我去搜索並找到了答案: https://github.com/webadvanced/Structuremap.MVC5/issues/15

public void ScanTypes(TypeSet types, Registry registry) 
{ 
    types.AllTypes().ForEach(type => 
    { 
     if (type.CanBeCastTo<Controller>() && !type.IsAbstract) 
     { 
      registry.For(type).LifecycleIs(new UniquePerRequestLifecycle()); 
     } 
    }); 
} 

的海報(我)是「不知道這是最好的一段路要走。」