Patch against the latest cvs
When using the transparent engine you rely on the
PrevalentSystemProxy to intercept your method calls and
turn them into serializable commands. However if the
system class has fields which themselves have methods
they will not be intercepted and hence the changes they
make will not be saved. For example, in the
MyFirstPrevalentSystem if you were to call the
set_Summary method of an instance of the Task class
after it had been added to the ToDoList then the change
would not be recorded.
My solution involves watching the return types of
method calls that go through the PrevalentSystemProxy
and if they are derived from MarshalByRefObject to
replace them with a new proxy that will be able to
intercept the method calls. This however is only half
the problem. Once the call has been intercepted, the
information needed to complete the call must be stored
in a command class. This presents a difficulty, because
we dont know where our method owner is referenced in
the system class. At the moment my proxy searches
public and non-public fields of the system class for
the methods owner. If that fails it checks to see if
any of the fields implement IList and if so checks its
contents for the methods owner. If it is found then
the method's owner's location, the method's name and
the arguments are saved to a command and executed.
Otherwise the method is executed normally.
I understand that this approach has a number
limitations, including...
1. Any references to objects stored in the system that
aren't provided by method calls from the "system" class
won't be proxied.
2. There in no guarantee that the objects that we proxy
are stored in the "system" class.
3. The protection of the _system field has to be
changed from private to internal because the private
members of _system cannot be reflected in the
PrevalentSystemProxy.
4. Member classes that are to be proxied must be a
derivative of MarshalByRefObject.
5. An O(n) search must be conducted of the "system"
class's fields for every proxied method. (This
information may be cacheable...)
I think that most of these limitations can be minimised
with further development.
Bamboo.Prevalence.patch