diff --git a/ReliableDbProvider.Tests/MassiveTests.cs b/ReliableDbProvider.Tests/MassiveTests.cs index 0d71df9..1a3ba06 100644 --- a/ReliableDbProvider.Tests/MassiveTests.cs +++ b/ReliableDbProvider.Tests/MassiveTests.cs @@ -1,10 +1,6 @@ -using System.Configuration; -using System.Data.Entity; -using System.Dynamic; -using System.Linq; +using System.Dynamic; using Massive; using NUnit.Framework; -using ReliableDbProvider.SqlAzureWithTimeoutRetries; using ReliableDbProvider.Tests.Config; using ReliableDbProvider.Tests.SqlExpress; @@ -35,7 +31,7 @@ public void Insert_and_select() table.Insert(userProperty); - var dbUser = table.Single(Id: userProperty.Id); + var dbUser = table.Single(Id: userProperty.ID); Assert.That(dbUser.Name, Is.EqualTo(userProperty.Name)); } diff --git a/ReliableDbProvider/ReliableSqlClientProvider.cs b/ReliableDbProvider/ReliableSqlClientProvider.cs index 455c827..cbff259 100644 --- a/ReliableDbProvider/ReliableSqlClientProvider.cs +++ b/ReliableDbProvider/ReliableSqlClientProvider.cs @@ -1,5 +1,6 @@ using System; using System.Data.Common; +using System.Data.SqlClient; using System.Security; using System.Security.Permissions; using Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure; @@ -38,9 +39,7 @@ public object GetService(Type serviceType) public override DbCommand CreateCommand() { - // If I return null then the command is grabbed using the connection - // This allows for it to be wrapped by the reliable command infrastructure - return null; + return new ReliableSqlCommand(new SqlCommand()); } #region NotSupported diff --git a/ReliableDbProvider/ReliableSqlCommand.cs b/ReliableDbProvider/ReliableSqlCommand.cs index e0c5138..7065ce3 100644 --- a/ReliableDbProvider/ReliableSqlCommand.cs +++ b/ReliableDbProvider/ReliableSqlCommand.cs @@ -51,6 +51,8 @@ protected override DbConnection DbConnection get { return Current.Connection; } set { + if (value == null) + return; ReliableConnection = ((ReliableSqlDbConnection)value).ReliableConnection; Current.Connection = ReliableConnection.Current; }