デモMVC3インターネットアプリケーションテンプレートで遊んでいて、ServiceStack.Host.MvcNuGetパッケージをインストールしました。Funqがコンストラクタインジェクションを実行する際に問題が発生しました。
次のスニペットは正常に機能しています。
public class HomeController : ServiceStackController
{
public ICacheClient CacheClient { get; set; }
public ActionResult Index()
{
if(CacheClient == null)
{
throw new MissingFieldException("ICacheClient");
}
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
public ActionResult About()
{
return View();
}
}
以下はエラーをスローします
インターフェイスのインスタンスを作成できません。
public class HomeController : ServiceStackController
{
private ICacheClient CacheClient { get; set; }
public ActionResult Index(ICacheClient notWorking)
{
// Get an error message...
if (notWorking == null)
{
throw new MissingFieldException("ICacheClient");
}
CacheClient = notWorking;
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
public ActionResult About()
{
return View();
}
}
公有財産の注入が機能するので大したことではありませんが、私は何が欠けているのか知りたいです。