我有其中ID參數都標註有CacheType屬性我怎樣才能閱讀網頁API行爲過濾參數屬性值
public Object Get([CacheType(CacheTypes.Venue)]int Id)
{
....
}
的API方法我可以讀取參數屬性的ActionFilterAttribute內的值
public class CacheOutputAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
{
//read CacheType value
}
}
你是否自己綁定了任何東西,還是隻是從網上覆制代碼並要求我們爲你做這件事? –
在反射的幫助下可能會有這種可能 – Fabjan