Example #1
0
        private static void TestNonScopedExcecution()
        {
            Console.WriteLine("Execution without transaction");

            VolatileResourceManager volatileResourceManager = new VolatileResourceManager();
            S3BucketResourceManager s3BucketResourceManager = new S3BucketResourceManager("upload-bucket");

            volatileResourceManager.SetProperty(3);
            s3BucketResourceManager.UploadImage("image.jpg");

            Console.WriteLine($"VolatileResourceManager Property Value: {volatileResourceManager.Property}");
        }
Example #2
0
        private static void TestScopeAborted()
        {
            Console.WriteLine("Transaction scope aborting without Complete()");

            VolatileResourceManager volatileResourceManager = new VolatileResourceManager();
            S3BucketResourceManager s3BucketResourceManager = new S3BucketResourceManager("upload-bucket");

            using (TransactionScope transactionScope = new TransactionScope())
            {
                volatileResourceManager.SetProperty(3);
                s3BucketResourceManager.UploadImage("image.jpg");
            }

            Console.WriteLine($"VolatileResourceManager Property Value: {volatileResourceManager.Property}");
        }