﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on Reflections on the Naked CLR</title><description>Beginner, here is is, in its naked glory:
  
  
using System;
  
using System.Collections.Generic;
  
using System.Text;
  
using System.Data;
  
using System.Data.SqlClient;
  
using BookStore.Properties;
  
  
namespace BookStore.Util
  
{
  
    public static class With
  
    {
  
        public delegate T Func&lt;T&gt;(SqlCommand command);
  
        public delegate void Proc(SqlCommand command);
  
  
        public static T Transaction&lt;T&gt;(Func&lt;T&gt; exec)
  
        {
  
            T result = default(T);
  
            Transaction(delegate(SqlCommand command)
  
            {
  
                result = exec(command);
  
            });
  
            return result;
  
        }
  
  
        public static void Transaction(Proc exec)
  
        {
  
            using (SqlConnection connection = new SqlConnection(Settings.Default.Database))
  
            {
  
                connection.Open();
  
                SqlTransaction tx = connection.BeginTransaction();
  
                try
  
                {
  
                    using (SqlCommand command = connection.CreateCommand())
  
                    {
  
                        command.Transaction = tx;
  
                        exec(command);
  
                    }
  
                    tx.Commit();
  
                }
  
                catch
  
                {
  
                    tx.Rollback();
  
                    throw;
  
                }
  
                finally
  
                {
  
                    tx.Dispose();
  
                }
  
            }
  
        }
  
  
    }
  
}
  
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment12</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment12</guid><pubDate>Tue, 29 May 2007 11:31:45 GMT</pubDate></item><item><title>foobar commented on Reflections on the Naked CLR</title><description>[Oren]
  
That's what I figured after I'd read two of your earlier scathing posts.
  
  
Thank you for confirming it.
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment11</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment11</guid><pubDate>Mon, 28 May 2007 21:08:04 GMT</pubDate></item><item><title>Ayende Rahien commented on Reflections on the Naked CLR</title><description>Foobar,
  
That is a term invented by yours truly to refer to the CLR without any additional frameworks, basically, just the CLR Runtime Redistributable, and building up from there.
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment10</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment10</guid><pubDate>Mon, 28 May 2007 19:28:39 GMT</pubDate></item><item><title>Gian Maria commented on Reflections on the Naked CLR</title><description>Very interesting stuff
  
  
Alk.
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment9</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment9</guid><pubDate>Mon, 28 May 2007 10:07:54 GMT</pubDate></item><item><title>Ayende Rahien commented on Reflections on the Naked CLR</title><description>No, that is simply missing the rest of it.
  
Transaction&lt;T&gt;(Func&lt;T&gt; exec)
  
{
  
   T result = null;
  
   Transaction(delegate(IDbCommand command)
  
   {
  
       result = exec(command);
  
   });
  
   return result;
  
}
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment8</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment8</guid><pubDate>Mon, 28 May 2007 04:35:26 GMT</pubDate></item><item><title>Gunnlaugur Briem commented on Reflections on the Naked CLR</title><description>Slight bogosity in that Transaction method. It's missing the type parameter and it's void, the exec return value is discarded. Posting a little too fast? :)
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment7</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment7</guid><pubDate>Mon, 28 May 2007 03:06:16 GMT</pubDate></item><item><title>Chris Khoo commented on Reflections on the Naked CLR</title><description>Hi man
  
  
Even though you're not a native English speaker, I find your blog to be one of the most enjoyable &amp; interesting to keep up with, even if you post like 5 times a day :-).
  
  
I hope a major publisher approaches you to write a book on enterprise architecture one day - that is if you want to.
  
  
Chris
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment6</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment6</guid><pubDate>Sun, 27 May 2007 13:44:24 GMT</pubDate></item><item><title>Ken Egozi commented on Reflections on the Naked CLR</title><description>@Bil:
  
I guess I still have a head explosion ahead of me, since I'm not using ReSharper yet (it slowed my machine too much, and I use rather a strogng enough machine, 3.0HT+2GB), and my laptop is a poor 1.7+756MB so no ReSharper will fit in currently :(
  
  
@Ayende:
  
Is this "teaching" a part of mentoring new members, or is it a paid activity (thus, you have clients who pay you to mentor their employees? I guess those are clients worth working for )
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment5</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment5</guid><pubDate>Sun, 27 May 2007 08:45:12 GMT</pubDate></item><item><title>Ayende Rahien commented on Reflections on the Naked CLR</title><description>Connor, 
  
That is the class name for the Transaction method, just a convention that I use for this type of stuff.
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment4</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment4</guid><pubDate>Sun, 27 May 2007 06:25:20 GMT</pubDate></item><item><title>Bil Simser commented on Reflections on the Naked CLR</title><description>Naked CLR is boring, but once the light bulb turns on and they "get it" you'll see a huge difference. It's the same when I'm mentoring guys on refactoring. I make them (and myself) go through the pain and suffering of doing refactorings manually so that they know why they're doing them. Then I show them ReSharper. Then I introduce them to the keyboard and live templates. Then their heads explode. It's all a very natural progression.
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment3</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment3</guid><pubDate>Sun, 27 May 2007 01:13:06 GMT</pubDate></item><item><title>connor peterson commented on Reflections on the Naked CLR</title><description>What/where is the "With" in With.Transaction?
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment2</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment2</guid><pubDate>Sun, 27 May 2007 01:01:18 GMT</pubDate></item><item><title>Eber Irigoyen commented on Reflections on the Naked CLR</title><description>now you are teacher too??
  
  
dude
</description><link>http://ayende.com/2444/reflections-on-the-naked-clr#comment1</link><guid>http://ayende.com/2444/reflections-on-the-naked-clr#comment1</guid><pubDate>Sat, 26 May 2007 23:43:34 GMT</pubDate></item></channel></rss>