0
我最近在一個新的MVC項目上實現了Windsor(兩者都是新的),並且在實施服務時遇到了麻煩。實現溫莎,遷移和有問題
該服務是一個small toolkit project for linkedin that uses c#。在提供的示例中,可以這樣設置服務:
在App_Start/AuthConfig.cs中,我創建了一個新實例linkedInOAuthClient
,這是使用該工具包的主要對象。
LinkedInOAuthClient linkedInOAuthClient = new LinkedInOAuthClient(new CookieAccessTokenStorage(ConfigurationManager.AppSettings["apiSecret"]),
new DotNetOpenAuthWebConsumer(ServiceDescriptions.Authenticate,
new InMemoryOAuthTokenManager(ConfigurationManager.AppSettings["apiKey"], ConfigurationManager.AppSettings["apiSecret"])));
我然後設置一個靜態對象LinkedInService
實現ILinkedInService
到linkedInOAuthClient
LinkedInServiceHelper.LinkedInService = linkedInOAuthClient;
然後在我的控制器
public ILinkedInService LinkedInService { get; set; }
public HomeController(ILinkedInService linkedInService)
{
LinkedInService = linkedInService;
}
才能使用該服務
。
我的問題是:我如何遷移LinkedInService以使用Windsor?
我已經註冊LinkedInService的設施,並在溫莎
public class LinkedInFacility : AbstractFacility
{
protected override void Init()
{
Kernel.Register(Component.For<ILinkedInService>()
.ImplementedBy<LinkedInOAuthClient>().LifestyleTransient());
}
}
安裝它,但我很茫然,以如何實現linkedInOAuthClient
任何幫助嗎?
神奇謝謝! –