Contents tagged with Generics

  • WCF Masterclass with Juval Lowy

    I have been lucky enough to be attending a WCF Masterclass this week taught by Juval Lowy and organised by readify. Its an awesome course and I am learning an incredible amount about WCF (Windows Communication Foundation). You know you’re on a good course when not only do you learn a lot about the specific topic of the course, but I am also picking up an incredible amount of useful tips and code along the way, not strictly tied to WCF.

    For example, I never knew that Juval created and delivered a set of transactional objects for use as a Volatile Resource Manager. By this I mean, that an integer is transactional, a DictionaryList is transactional, a string is transactional, a List, queue and Array are transactional, and these objects can participate in full fledged transactions, whether using the Lightweight transaction manager, Kernel Transaction Manager, Distributed Transaction Co-ordinator or other derivative.

    For example:

    TransactionalArray<int> numbers = new TransactionalArray<int>(3);

    numbers[0] = 1;

    numbers[1] = 2;

    numbers[2] = 3;

     

    using (TransactionScope scope = new TransactionScope() )

    {

      numbers[0] = 99;

      numbers[1] =88;

      numbers[2] =77;

    }

     

    // numbers[2] == 3 at this point as we did not Complete/Commit the transaction before it exited the scope.

     

    TransactionalArray<int> numbers = new TransactionalArray<int>(3);

    numbers[0] = 0;

    numbers[1] = 0;

    numbers[2] = 0;

     

    using (TransactionScope scope = new TransactionScope() )

    {

      numbers[0] = 99;

      numbers[1] =88;

      numbers[2] =77;

      scope.Complete();

    }

     

    // numbers[2] == 77 at this point as we DID Complete/Commit the transaction before it exited the scope.

    Apparently Juval released this stuff way back in late 2005 (and is on MSDN somewhere). I just had no idea, and its a super cool implementation of transacted objected. Again, these guys fully participate in all manner of promotable transactions. Juval has included transactable generic versions of all the collections. You can grab it from this page, Just look for Volatile Resource Managers.

    Read more...