ASP.NET MVC 3:ModelBoundオブジェクトをFilterAttributeに渡すことはできますか?
質問
カスタムFilterAttributeを備えたコントローラーメソッドがあります...
[ActivityHistory]
public ActionResult Index(Vehicle vehicle, string componentName)
{
return PartialView("_Description");
}
ActivityHistoryクラス...
public class ActivityHistoryAttribute : FilterAttribute, IResultFilter
{
public void OnResultExecuting(ResultExecutingContext filterContext)
{
//I would like to use the Vehicle object passed into the controller here
//The cotroller call is made from jQuery and json, the ASP.NET MVC modelbinding
// is creating the c# object instance. Can I resuse this object within this method?
}
}
それは私の質問ですが、カスタム属性クラスでモデルに結合した車両オブジェクトを再利用できますか?そのオブジェクトへの参照をカスタム属性クラスに渡すにはどうすればよいですか。
可能であれば、これをどのように達成できるかについてのヒントやアイデアをありがとう。
乾杯、サンディエゴの〜CK
正しい解決策はありません
所属していません StackOverflow