Asp.net mvc 3 是否可以从mvc3中的操作筛选器访问参数?
我的mvc 3 web应用程序中有一个自定义操作过滤器,用于在数据库上执行日志,我希望获得有关访问用户的操作的更多信息,因此我现在有以下代码:Asp.net mvc 3 是否可以从mvc3中的操作筛选器访问参数?,asp.net-mvc-3,parameters,action-filter,custom-action-filter,Asp.net Mvc 3,Parameters,Action Filter,Custom Action Filter,我的mvc 3 web应用程序中有一个自定义操作过滤器,用于在数据库上执行日志,我希望获得有关访问用户的操作的更多信息,因此我现在有以下代码: [ActionFilters.ProductStream(Message = "PUBLISH a Product")] public ActionResult PublishProducts(PublishedContainerVO publishedContainer) { //some code } 我想这样做: [ActionFilters
[ActionFilters.ProductStream(Message = "PUBLISH a Product")]
public ActionResult PublishProducts(PublishedContainerVO publishedContainer) {
//some code
}
我想这样做:
[ActionFilters.ProductStream(Message = "PUBLISH a Product", Id = publishedContainer.Id)]
public ActionResult PublishProducts(PublishedContainerVO publishedContainer) {
//some code
}
可能吗?我已经看到,在动作过滤器内,我可以通过他的键访问该参数,但在本例中。。。我有一个复杂的对象,而不是一个简单的id。您不能,因为元数据是在编译时创建的