Storing and retrieving Action<T> VALUES [and Func<T1, T2>] (SOLVED)

Jun 2, 2013 at 9:48 PM
Hi !

I am looking for saving stateengines state into a local db.
So, the currently assigned actions/Funcs inside the
stateengine are importent to me.

Is this possible ??
I am just on DB4O, because I can update my agents
databases remotely.

Thanks anyway and
best regards,

++mabra
Coordinator
Jun 26, 2013 at 6:48 PM
I don't think it is possible. Action and Func are delegates which are storing address to memory, when the code to invoke (method) is laying. You could store such objects in NDatabase, but then you will have a problem after retrieving them because runtime is changing. I've tried few ways to do that, but simply it is not easy (or possible) to restore original status to run particular code/method.

Hope it make it clear,
Jacek
Jun 26, 2013 at 7:08 PM
Hi !

Oh my, yes, thanks - naturally, I should have known this .....
It came from a question, how to persist state of a statemachine, which has
wired action's to handle ...

Thanks,
++mabra
Coordinator
Jun 28, 2013 at 6:34 PM
You could represent your state machine as some state which could use set of methods you define. When object is retrieved, it understands all runtime possibilities of it so you could restore state machine to set of Action/Func/Methods invocaitons.
Jun 28, 2013 at 6:37 PM
jacek wrote:
You could represent your state machine as some state which could use set of methods you define. When object is retrieved, it understands all runtime possibilities of it so you could restore state machine to set of Action/Func/Methods invocaitons.
Hi !

Thanks, yes, thats similar to that, I am currently thinking about !

br,
++mabra