actionInstance is always null

10 views
Skip to first unread message

schiffm

unread,
Jan 20, 2012, 2:18:17 PM1/20/12
to ExtDirectHandler
In DirectHandler.cs, the Handle method always receives a null
actionInstance object. This causes a new instance of every type to be
created for every request.

The code suggests that there may be support for reusing a previous
instance of a type, but I don't know how to make it work that way.
I've tried with and without an interceptor delegate function. What am
I missing? I'm using a reflection configurator to register the types.

I can provide sample code if necessary. Thanks for any help.

Gian Marco Gherardi

unread,
Jan 20, 2012, 2:21:32 PM1/20/12
to extdirec...@googlegroups.com
You can control the creation of Action instances by following this example:

schiffm

unread,
Jan 20, 2012, 2:42:25 PM1/20/12
to ExtDirectHandler
Thanks for the prompt response.

I don't have Windsor, and I'm not using the mvc framework. Can you
suggest another way to keep an instance around? Thanks.

On Jan 20, 2:21 pm, Gian Marco Gherardi <gianmarco.ghera...@gmail.com>
wrote:

Gian Marco Gherardi

unread,
Jan 20, 2012, 2:51:17 PM1/20/12
to extdirec...@googlegroups.com
Apart from using an IOC you have plenty of ugly options: you can keep it in an static field, you can keep it in the session,...

Or you can simply reistantiate the action on each request, that is the most reasonable approach when working with web apps

Gian Marco Gherardi
http://gianmarco.gherardi.me
Reply all
Reply to author
Forward
0 new messages