Is there a way to get the functionality of action filters in asp.net mvc where you can call and manipulate action parameters pre the method executing and post method call to update/view the return type data but in a standard c# class library class method?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
This sounds a lot like aspect-oriented programming. PostSharp is an example of a tool that can help you get there. A common example is to have a class auto-implement INotifyPropertyChanged
, which is boring or tedious, or to spit out a bunch of logging statements before and after a method call, without having to manually write that instrumentation in code.
Hope that gets you on the right track.