Can I use the decorator pattern to wrap a method body?

后端 未结 7 1940
醉话见心
醉话见心 2020-12-10 11:01

I have a bunch of methods with varying signatures. These methods interact with a fragile data connection, so we often use a helper class to perform retries/reconnects, etc.

7条回答
  •  孤城傲影
    2020-12-10 11:17

    This type of problem is pretty much what AOP (aspect oriented programming) aims to solve. Tools such as PostSharp can provide cross-cutting concerns by re-writing the compiled code. Scott Hanselman's podcast recently discussed AOP, so it might be worth having a listen.

提交回复
热议问题