NolanEvans
08-08-2006, 08:29 PM
I have been using externally called aspects for quite some time now, however i was wondering how to weave a aspect in such that any internal call will also execute the aspect code.
I am trying to wrap a aspect around all methods in a class such that any call to the method, including an internal one will call the aspect.
public interface ConnectionInterface
{
string Reserve();
void Connect();
void Disconnect();
string StatusCheck(string number_string);
}
public class ASession_class : ConnectionInterface
{
public string Reserve()
{
Debug.WriteLine("I am going to reserve a number.");
helloworld(); //aspect should wrap this method too
return "9995551212";
}
private void helloworld()
{
}
public void Connect()
{
Debug.WriteLine("You are now connected.");
}
public void Disconnect()
{
Debug.WriteLine("You are now disconnected.");
}
public string StatusCheck(string number_string)
{
Debug.WriteLine("checked status for " + number_string);
return "SPARE";
}
}
So I want a aspect that intercepts the internal call to "helloworld", I have been trying to use "introductions", however I cannot get them to work. Is there an example of one out there?
Can this be done with Spring.NET's AOP platform?
I am trying to wrap a aspect around all methods in a class such that any call to the method, including an internal one will call the aspect.
public interface ConnectionInterface
{
string Reserve();
void Connect();
void Disconnect();
string StatusCheck(string number_string);
}
public class ASession_class : ConnectionInterface
{
public string Reserve()
{
Debug.WriteLine("I am going to reserve a number.");
helloworld(); //aspect should wrap this method too
return "9995551212";
}
private void helloworld()
{
}
public void Connect()
{
Debug.WriteLine("You are now connected.");
}
public void Disconnect()
{
Debug.WriteLine("You are now disconnected.");
}
public string StatusCheck(string number_string)
{
Debug.WriteLine("checked status for " + number_string);
return "SPARE";
}
}
So I want a aspect that intercepts the internal call to "helloworld", I have been trying to use "introductions", however I cannot get them to work. Is there an example of one out there?
Can this be done with Spring.NET's AOP platform?