Just curious, is there any support for transactions on plain C# objects? Like
using (var transaction = new ObjectTransaction(obj))
{
try
{
obj.Prop1
Juval Lowy has written about this. Here is a link to his original MSDN article (I first heard about the idea in his excellent WCF book). Here's a code example from MSDN, which looks like what you want to achieve:
public class MyClass
{
Transactional m_Number = new Transactional(3);
public void MyMethod()
{
Transactional city = new Transactional("New York");
using(TransactionScope scope = new TransactionScope())
{
city.Value = "London";
m_Number.Value = 4;
m_Number.Value++;
Debug.Assert(m_Number.Value == 5);
//No call to scope.Complete(), transaction will abort
}
}