Just curious, is there any support for transactions on plain C# objects? Like
using (var transaction = new ObjectTransaction(obj))
{
try
{
obj.Prop1
No, there isn't currently anything like this built into .net or C#.
However depending on your usage requirements you could implement something that did the job for you.
Your ObjectTransaction class would serialise (or just duplicate) the object and hold the copy during the transaction. If you called commit the copy could just be deleted, but if you called rollback you could restore all of the properties on the original object from the copy.
There are lots of caveats to this suggestion.
All that said, a project I worked on a few years ago did do something exactly like this. Under very strict restrictions it can work really nicely. We only supported our internal business layer data objects. And they all had to inherit from a base interface that provided some additional meta data on property types, and there were rules on what events could be triggered from property setters. We would start the transaction, then bind the object to the GUI. If the user hit ok, the transaction was just closed, but if they hit cancel, the transaction manager unbound it from the GUI and rolled back all the changes on the object.