2012-09-06 92 views
4

我在尋找ProDiner示例MVC項目。我更新從2Castle Windsor FirstInterface()。Configure(c => c.LifeStyle.PerWebRequest)

public static void RegisterAllFromAssemblies(string a) 
    { 
     IoC.Container.Register(
      AllTypes.FromAssemblyNamed(a).Pick().WithService 
      .FirstInterface().Configure(c=> c.LifeStyle.PerWebRequest)); 
    } 

的溫莎城堡參考3 c.LifeStyle.PerWebRequest有一個紅色波浪說

Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement  

我該如何解決這個問題?

+2

.FirstInterface()。Configure(reg => reg.LifestylePerWebRequest()));這似乎正在編譯.... –

回答

6

其中一些方法調用現在被標記爲過時。這是使用api的最新方式:

container.Register(
    Castle.MicroKernel.Registration.Classes.FromAssemblyNamed(a) 
    .WithServiceFirstInterface() 
    .LifestylePerWebRequest() 
);