<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Eulogika srl</title>
	<atom:link href="http://www.eulogika.net/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.eulogika.net</link>
	<description>Sviluppo Software Personalizzato</description>
	<lastBuildDate>Fri, 13 Apr 2012 14:37:56 +0000</lastBuildDate>
	<language>it</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Entity Framework, Commit/RollBack e Transazioni</title>
		<link>http://www.eulogika.net/index.php/entity-framework-commitrollback-and-transactions/</link>
		<comments>http://www.eulogika.net/index.php/entity-framework-commitrollback-and-transactions/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 06:57:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Developer]]></category>
		<category><![CDATA[Commit]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[RollBack]]></category>
		<category><![CDATA[Transactions]]></category>

		<guid isPermaLink="false">http://www.eulogika.net/?p=1178</guid>
		<description><![CDATA[Merita un appunto questo pezzo di codice, che serve a gestire transazioni annidate. Vi capita di vedere questi messaggi ? &#8220;New transaction is not allowed because there are other threads running in the session.&#8221; &#160; Allora probabilmente dovete spezzare la logica dei vostri loop di aggiornamento dati, oppure usare le transazioni : &#160; public TransactionScope [...]]]></description>
			<content:encoded><![CDATA[<p>Merita un appunto questo pezzo di codice, che serve a gestire transazioni annidate.</p>
<p>Vi capita di vedere questi messaggi ?</p>
<p>&#8220;New transaction is not allowed because there are other threads running in the session.&#8221;</p>
<p>&nbsp;</p>
<p>Allora probabilmente dovete spezzare la logica dei vostri loop di aggiornamento dati,</p>
<p>oppure usare le transazioni :</p>
<p>&nbsp;</p>
<pre class="brush: js">
public TransactionScope CreateTransactionScope()
{
var transactionOptions = new TransactionOptions();
transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;
transactionOptions.Timeout = TimeSpan.MaxValue;

return new TransactionScope(TransactionScopeOption.Required, transactionOptions);
}

using (TransactionScope scope = new TransactionScope())
{
// Save changes but maintain context1 current state.
context1.SaveChanges(SaveOptions.DetectChangesBeforeSave);

// Save changes but maintain context2 current state.
context2.SaveChanges(SaveOptions.DetectChangesBeforeSave);

// Commit succeeded since we got here, then completes the transaction.
scope.Complete();

// Now it is safe to update context state.
context1.AcceptAllChanges();
context2.AcceptAllChanges();
}</pre>
<p>(articolo originale : <a href="http://www.luisrocha.net/">http://www.luisrocha.net/</a>)</p>
<p>Happy Coding !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.eulogika.net/index.php/entity-framework-commitrollback-and-transactions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

