PDA

View Full Version : AOP Question


henryxuv
07-09-2007, 03:49 AM
i am a new user of Spring.net.i conclude below from samples and books

as mostly sample, the AOP will effect the source code .not as simple as Ioc

and i don't know if it is wrong.

in my opinion. below is common sample
here is a interface,
public ICommand
{
void execute();
}
public MyCommand:ICommand
{
void execute()
{
void execute()
{
Console.writeline("hello");
}
}
and others is a advice, a interceptor.
main app use ProxyFactory get a interface ICommand.when call ICommand function. the Aop will use our Advice and interceptor to operate as i hoped.

my question is if i can let the proxy return me a object reference, not a interface reference. in fact . i want aop help me to intercept form user message. so i need the form object. hope somebody can help me. i am a chinese. so maybe,i can't express my question well. i am sorry for that. i just need your help.thanks. my email is henryxuv@sina.com and henryxuv@gmail.com

henryxuv
07-09-2007, 09:03 AM
here is my code . I hope before pepole click the button on the form. there will be a message "I am Before Click" show.
can anybody tell me if my goal can achived. how.and now what's the problem with my code. when my code run. it will be error on create ProxyFactory.return value is null. if the proxyFactory can only return the reference to a interface. can i converse that reference to a object

Bruno Baia
07-16-2007, 04:38 PM
Hi,

You can't achieve this by proxying directly the Form object.
What you can do is to delegate user actions to a controller class which will be proxied.

HTH,
Bruno

henryxuv
07-18-2007, 12:22 PM
ok thank you , i got it