Skip to content

Commit

Permalink
Updated to latest NHibernate and v5 transient fault handling, added n…
Browse files Browse the repository at this point in the history
…ew sql azure error codes and added restriction that disallows EL6 since it breaks the library
  • Loading branch information
robdmoore committed May 13, 2013
1 parent b79418e commit 04647aa
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 24 deletions.
12 changes: 7 additions & 5 deletions NHibernate.SqlAzure.Tests/NHibernate.SqlAzure.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,16 @@
<Reference Include="Microsoft.Practices.EnterpriseLibrary.Common">
<HintPath>..\packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35\Microsoft.Practices.EnterpriseLibrary.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling">
<HintPath>..\packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.0.1118.2\lib\NET4\Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.dll</HintPath>
<Reference Include="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling, Version=5.1.1209.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.1.1209.1\lib\NET4\Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.TransientFaultHandling.Core">
<HintPath>..\packages\TransientFaultHandling.Core.5.0.1118.2\lib\NET35\Microsoft.Practices.TransientFaultHandling.Core.dll</HintPath>
<Reference Include="Microsoft.Practices.TransientFaultHandling.Core, Version=5.1.1209.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\TransientFaultHandling.Core.5.1.1209.1\lib\NET4\Microsoft.Practices.TransientFaultHandling.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Unity">
<HintPath>..\packages\Unity.2.1.505.0\lib\NET35\Microsoft.Practices.Unity.dll</HintPath>
Expand All @@ -84,7 +86,7 @@
</Reference>
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NHibernate.3.3.1.4000\lib\Net35\NHibernate.dll</HintPath>
<HintPath>..\packages\NHibernate.3.3.3.4000\lib\Net35\NHibernate.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
6 changes: 3 additions & 3 deletions NHibernate.SqlAzure.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<packages>
<package id="CommonServiceLocator" version="1.0" />
<package id="EnterpriseLibrary.Common" version="5.0.505.0" />
<package id="EnterpriseLibrary.WindowsAzure.TransientFaultHandling" version="5.0.1118.2" />
<package id="EnterpriseLibrary.WindowsAzure.TransientFaultHandling" version="5.1.1209.1" targetFramework="net40" />
<package id="FluentMigrator" version="1.0.3.0" />
<package id="FluentMigrator.Tools" version="1.0.3.0" />
<package id="FluentNHibernate" version="1.3.0.733" />
<package id="Iesi.Collections" version="3.3.1.4000" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
<package id="NBuilder" version="3.0.1.1" />
<package id="NHibernate" version="3.3.1.4000" />
<package id="NHibernate" version="3.3.3.4000" targetFramework="net40" />
<package id="NHibernateProfiler" version="1.0.0.951" />
<package id="NUnit" version="2.6.2" targetFramework="net40" />
<package id="TransientFaultHandling.Core" version="5.0.1118.2" />
<package id="TransientFaultHandling.Core" version="5.1.1209.1" targetFramework="net40" />
<package id="Unity" version="2.1.505.0" />
<package id="Unity.Interception" version="2.1.505.0" />
<package id="WebActivator" version="1.4.4" />
Expand Down
8 changes: 4 additions & 4 deletions NHibernate.SqlAzure.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.SqlAzure", "NHibernate.SqlAzure\NHibernate.SqlAzure.csproj", "{C51908DF-FAEA-4EAA-8F75-096346537C33}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{ED8FDCE1-6823-4A58-8CA6-BBF4E128CFC8}"
Expand All @@ -12,8 +12,8 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{9C23CAA3-08A2-498A-AB98-F803AC42C49E}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
README.md = README.md
logo.png = logo.png
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.SqlAzure.Tests", "NHibernate.SqlAzure.Tests\NHibernate.SqlAzure.Tests.csproj", "{887FD0A4-B8E0-4B3D-BF7E-4CC7090EB829}"
Expand All @@ -37,6 +37,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.Interception.2.1.505.0\lib\NET35;packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35;packages\TransientFaultHandling.Core.5.0.1118.2\lib\NET35;packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.0.1118.2\lib\NET4;packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.0.1118.2\DesignTime
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35;packages\Unity.Interception.2.1.505.0\lib\NET35;packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35;packages\TransientFaultHandling.Core.5.0.1118.2\lib\NET35;packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.0.1118.2\lib\NET4;packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.0.1118.2\DesignTime;packages\TransientFaultHandling.Core.5.1.1209.1\lib\NET4;packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.1.1209.1\lib\NET4;packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.1.1209.1\DesignTime
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions NHibernate.SqlAzure/NHibernate.SqlAzure.Standalone.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
en-US
</language>
<dependencies>
<dependency id="NHibernate" version="3.3.1.4000" />
<dependency id="EnterpriseLibrary.WindowsAzure.TransientFaultHandling" version="5.0.1118.2" />
<dependency id="NHibernate" version="3.3.3.4000" />
<dependency id="EnterpriseLibrary.WindowsAzure.TransientFaultHandling" version="[5.1.1209.1,6.0)" />
</dependencies>
</metadata>
<files>
Expand Down
12 changes: 7 additions & 5 deletions NHibernate.SqlAzure/NHibernate.SqlAzure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@
<Reference Include="Microsoft.Practices.EnterpriseLibrary.Common">
<HintPath>..\packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35\Microsoft.Practices.EnterpriseLibrary.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling">
<HintPath>..\packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.0.1118.2\lib\NET4\Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.dll</HintPath>
<Reference Include="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling, Version=5.1.1209.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\EnterpriseLibrary.WindowsAzure.TransientFaultHandling.5.1.1209.1\lib\NET4\Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.TransientFaultHandling.Core">
<HintPath>..\packages\TransientFaultHandling.Core.5.0.1118.2\lib\NET35\Microsoft.Practices.TransientFaultHandling.Core.dll</HintPath>
<Reference Include="Microsoft.Practices.TransientFaultHandling.Core, Version=5.1.1209.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\TransientFaultHandling.Core.5.1.1209.1\lib\NET4\Microsoft.Practices.TransientFaultHandling.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Unity">
<HintPath>..\packages\Unity.2.1.505.0\lib\NET35\Microsoft.Practices.Unity.dll</HintPath>
Expand All @@ -79,7 +81,7 @@
</Reference>
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NHibernate.3.3.1.4000\lib\Net35\NHibernate.dll</HintPath>
<HintPath>..\packages\NHibernate.3.3.3.4000\lib\Net35\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion NHibernate.SqlAzure/NHibernate.SqlAzure.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
en-US
</language>
<dependencies>
<dependency id="NHibernate" version="3.3.1.4000" />
<dependency id="NHibernate" version="3.3.3.4000" />
</dependencies>
</metadata>
<files>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using System.Data.SqlClient;
using System.Linq;
using Microsoft.Practices.TransientFaultHandling;
using EntLibSqlAzureTransientErrorDetectionStrategy = Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure.SqlAzureTransientErrorDetectionStrategy;

Expand All @@ -20,7 +22,20 @@ private bool IsTransientAzureException(Exception ex)
if (ex == null)
return false;

return _entLibStrategy.IsTransient(ex) || IsTransientAzureException(ex.InnerException);
return _entLibStrategy.IsTransient(ex)
|| IsNewTransientError(ex)
|| IsTransientAzureException(ex.InnerException);
}

private bool IsNewTransientError(Exception ex)
{
// From Enterprise Library 6 changelog (see https://entlib.codeplex.com/wikipage?title=EntLib6ReleaseNotes):
// Error code 40540 from SQL Database added as a transient error (see http://msdn.microsoft.com/en-us/library/ff394106.aspx#bkmk_throt_errors).
// Added error codes 10928 and 10929 from SQL Database as transient errors (see http://blogs.msdn.com/b/psssql/archive/2012/10/31/worker-thread-governance-coming-to-azure-sql-database.aspx).

SqlException sqlException;
return (sqlException = ex as SqlException) != null
&& sqlException.Errors.Cast<SqlError>().Any(error => error.Number == 40540 || error.Number == 10928 || error.Number == 10929);
}
}
}
6 changes: 3 additions & 3 deletions NHibernate.SqlAzure/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<packages>
<package id="CommonServiceLocator" version="1.0" />
<package id="EnterpriseLibrary.Common" version="5.0.505.0" />
<package id="EnterpriseLibrary.WindowsAzure.TransientFaultHandling" version="5.0.1118.2" />
<package id="EnterpriseLibrary.WindowsAzure.TransientFaultHandling" version="5.1.1209.1" targetFramework="net40" />
<package id="Iesi.Collections" version="3.3.1.4000" />
<package id="ilmerge" version="2.12.0803" />
<package id="NHibernate" version="3.3.1.4000" />
<package id="TransientFaultHandling.Core" version="5.0.1118.2" />
<package id="NHibernate" version="3.3.3.4000" targetFramework="net40" />
<package id="TransientFaultHandling.Core" version="5.1.1209.1" targetFramework="net40" />
<package id="Unity" version="2.1.505.0" />
<package id="Unity.Interception" version="2.1.505.0" />
<package id="WindowsAzure.ServiceBus" version="1.6.0.0" targetFramework="net40" />
Expand Down

0 comments on commit 04647aa

Please sign in to comment.