<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>
			Comments on &quot;Entity Framework, TransactionScope and MSDTC&quot;
		</title>
		<link>http://www.digitallycreated.net/Blog/48/entity-framework-transactionscope-and-msdtc</link>
		<atom:link href="http://www.digitallycreated.net/Blog/48/entity-framework-transactionscope-and-msdtc/CommentRss" rel="self" type="application/rss+xml" />
		<description>
			A feed of all comments that are posted on the blog titled &quot;Entity Framework, TransactionScope and MSDTC&quot;.
		</description>
		<lastBuildDate>Sun, 05 Feb 2012 13:46:13 GMT</lastBuildDate>
		
		
			<item>
				<title>sib commented on &quot;Entity Framework, TransactionScope and MSDTC&quot;</title>
				<link>http://www.digitallycreated.net/Blog/48/entity-framework-transactionscope-and-msdtc#Comment36</link>
				<guid isPermaLink="false">DigitallyCreated Comment ID: 36</guid>
				<dc:creator>sib</dc:creator>
				<pubDate>Thu, 19 May 2011 09:11:07 GMT</pubDate>
				<description>
					Thanks a lot! You saved my day. The main reason we do not want to use MS DTC is because it can be turned off on client servers or can lack network permissions and deployment becomes nightmare!
				</description>
			</item>
		
		
			<item>
				<title>Unknown (myopenid) commented on &quot;Entity Framework, TransactionScope and MSDTC&quot;</title>
				<link>http://www.digitallycreated.net/Blog/48/entity-framework-transactionscope-and-msdtc#Comment62</link>
				<guid isPermaLink="false">DigitallyCreated Comment ID: 62</guid>
				<dc:creator>Unknown (myopenid)</dc:creator>
				<pubDate>Tue, 24 Jan 2012 15:07:44 GMT</pubDate>
				<description>
					Hi, I am writing a serial transaction and had some troubles.&lt;br/&gt;If I only execute one thread, it executes fast, no waiting.&lt;br/&gt;If I execute two or more threads, the first thread that complete takes too much time but subsequent threads are fast, why?&lt;br/&gt;&lt;br/&gt;If I run two process concurrently of this program, each process's first thread takes too much time to complete but subsequent are fast, is this normal?&lt;br/&gt;&lt;br/&gt;I am using sql express 2008&lt;br/&gt;&lt;br/&gt;tanks.&lt;br/&gt;&lt;br/&gt;class Program&lt;br/&gt;    {&lt;br/&gt;        int numero;&lt;br/&gt;&lt;br/&gt;        Program(int numero)&lt;br/&gt;        {&lt;br/&gt;            this.numero = numero;&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        static void Main(string[] args)&lt;br/&gt;        {&lt;br/&gt;            Console.WriteLine(&amp;quot;Puede presionar una tecla para salir en cualquier momento&amp;quot;);&lt;br/&gt;&lt;br/&gt;            for (int i = 0; i &amp;lt; 10; i++)&lt;br/&gt;            {&lt;br/&gt;                Program p = new Program(i + 1);&lt;br/&gt;                Thread t = new Thread(p.Ejecutar);&lt;br/&gt;                t.Start();&lt;br/&gt;            }&lt;br/&gt;&lt;br/&gt;            Console.ReadKey();&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        public void Ejecutar()&lt;br/&gt;        {  &lt;br/&gt;            bool esPosibleProseguir = true;&lt;br/&gt;            while (esPosibleProseguir)&lt;br/&gt;            {&lt;br/&gt;                Database1Entities cx = new Database1Entities();&lt;br/&gt;                TransactionOptions opts = new TransactionOptions();&lt;br/&gt;                opts.IsolationLevel = System.Transactions.IsolationLevel.Serializable;&lt;br/&gt;                System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope(TransactionScopeOption.Required, opts);&lt;br/&gt;&lt;br/&gt;                try&lt;br/&gt;                {&lt;br/&gt;                    //var mayor = cx.Numeracion.First();&lt;br/&gt;                    //int nuevo = mayor.Numero + 1;&lt;br/&gt;                    cx.Connection.Open();&lt;br/&gt;&lt;br/&gt;                    int nuevo = cx.VistaNumero.First().Actual;&lt;br/&gt;&lt;br/&gt;                    var per = new Persona();&lt;br/&gt;                    per.Nombre = string.Format(&amp;quot;Persona-{0}&amp;quot;, nuevo);&lt;br/&gt;                    per.Ci = (1000 + nuevo).ToString();&lt;br/&gt;                    per.Numero = nuevo;&lt;br/&gt;                    cx.Persona.AddObject(per);&lt;br/&gt;&lt;br/&gt;                    /&lt;a href=&quot;/mayor.&quot;&gt;/mayor.&lt;/a&gt;Numero = nuevo;&lt;br/&gt;&lt;br/&gt;                    cx.SaveChanges();&lt;br/&gt;                    scope.Complete();&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;                    Console.WriteLine(&amp;quot;Hilo: {0}, Crea persona: {1}&amp;quot;, this.numero, nuevo);&lt;br/&gt;                    break;&lt;br/&gt;                }&lt;br/&gt;                catch (UpdateException ex1)&lt;br/&gt;                {&lt;br/&gt;                    esPosibleProseguir = true;&lt;br/&gt;                }&lt;br/&gt;                catch (TransactionAbortedException ex2)&lt;br/&gt;                {&lt;br/&gt;                    esPosibleProseguir = true;&lt;br/&gt;                }&lt;br/&gt;                catch (Exception ex)&lt;br/&gt;                {&lt;br/&gt;                    Console.WriteLine(&amp;quot;Hilo: {0}, Excepci&amp;#243;n: {1}, Mensaje: {2}&amp;quot;, this.numero, ex.GetType().Name, ex.Message);&lt;br/&gt;                    esPosibleProseguir = false;&lt;br/&gt;                }&lt;br/&gt;                finally&lt;br/&gt;                {&lt;br/&gt;                    DisponerObjeto(scope);&lt;br/&gt;                    DisponerObjeto(cx);&lt;br/&gt;                }&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;        private void DisponerObjeto(IDisposable obj)&lt;br/&gt;        {&lt;br/&gt;            try&lt;br/&gt;            {&lt;br/&gt;                obj.Dispose();&lt;br/&gt;            }&lt;br/&gt;            catch (Exception ex)&lt;br/&gt;            {&lt;br/&gt;                Console.WriteLine(&amp;quot;Hilo: {0}, Excepci&amp;#243;n: {1}, Mensaje: {2}&amp;quot;, this.numero, ex.GetType().Name, ex.Message);&lt;br/&gt;            }&lt;br/&gt;        }&lt;br/&gt;    }
				</description>
			</item>
		
		
		
	</channel>
</rss>

