c# - Can you call a class member from within a PostSharp advice? -


So I'm working with PostSharp to remove boilerplate logging / exception handling code so that it is:

  Public Zero doSomething () {Logger.Write ("DoSomething entered"); {// code} Hold (Exception Pre) {ExceptionPolicy.HandleException (formerly, "Errors"); } wood cutter. Write ("Some works seeming"); }  

It gets:

  [log] [handle exception] public zero doSomething () {// code}  

However, at some places I have a code that has a known recovery point, so it looks like:

  public void doSomethig () {try {// code } Hold (prior to known acquisition) {ExceptionPolicy.HandleException (formerly, "known"); } Finally {this. Recover (); }}  

I would like to represent it as an advice, but I am not able to reach members of the class with advice.

Yes to invite a member of the target class with one aspect, you will be able to import this member into aspect Have to do. See.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -