SPRNET-1408 - Add data providers in System.Data.dll to be accessed via Spring's IDbProvider interface.

This commit is contained in:
markpollack
2011-07-09 17:11:12 +00:00
parent 795d8e1c6d
commit 54ab38569b
4 changed files with 251 additions and 41 deletions

View File

@@ -925,14 +925,6 @@
<Project>{AEB1578C-9018-4D49-B440-789F38DD2F29}</Project>
<Name>Spring.Messaging.Nms.2008</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Services\Spring.Services.2008.csproj">
<Project>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Project>
<Name>Spring.Services.2008</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Spring\Spring.Template.Velocity\Spring.Template.Velocity.2008.csproj">
<Project>{BF3AB954-8375-407C-9E98-4C51D8072784}</Project>
<Name>Spring.Template.Velocity.2008</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>

View File

@@ -109,7 +109,7 @@ namespace Spring.Data.Common
}
[Test]
public void DefaultInstanceWithSqlServer2005()
public void DefaultInstanceWithSqlServer20()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
//IApplicationContext ctx = DbProviderFactory.ApplicationContext;
@@ -155,7 +155,37 @@ namespace Spring.Data.Common
Assert.AreEqual(":Foo", provider.CreateParameterName("Foo"));
}
#endif
#if NET_4_0
[Test]
public void DefaultInstanceWithSqlServer40()
{
IDbProvider provider = DbProviderFactory.GetDbProvider("SqlServer-4.0");
AssertIsSqlServer40(provider);
Assert.IsNull(provider.ConnectionString);
Assert.IsNotNull(provider.CreateCommand());
Assert.IsNotNull(provider.CreateCommandBuilder());
Assert.IsNotNull(provider.CreateConnection());
Assert.IsNotNull(provider.CreateDataAdapter());
Assert.IsNotNull(provider.CreateParameter());
Assert.AreEqual("@Foo", provider.CreateParameterName("Foo"));
}
[Test]
public void DefaultInstanceWithOleDb40()
{
IDbProvider provider = DbProviderFactory.GetDbProvider("OleDb-4.0");
Assert.AreEqual("OleDb, provider V4.0.0.0 in framework .NET V4", provider.DbMetadata.ProductName);
Assert.IsNotNull(provider.CreateCommand());
Assert.IsNotNull(provider.CreateCommandBuilder());
Assert.IsNotNull(provider.CreateConnection());
Assert.IsNotNull(provider.CreateDataAdapter());
Assert.IsNotNull(provider.CreateParameter());
Assert.AreEqual("?", provider.CreateParameterName("Foo"));
}
#endif
//[Test]
//Comment in for specific testing with oracle as can't put oracle client in public code repository
public void DefaultInstanceWithOracleClient20()
@@ -185,7 +215,7 @@ namespace Spring.Data.Common
*/
[Test]
public void TestDb2()
public void TestSqlServer20Names()
{
//Initialize internal application context. factory
DbProviderFactory.GetDbProvider("SqlServer-2.0");
@@ -239,6 +269,13 @@ namespace Spring.Data.Common
AssertCommonSqlServerErrorCodes(provider);
}
private void AssertIsSqlServer40(IDbProvider provider)
{
Assert.AreEqual("Microsoft SQL Server, provider V4.0.0.0 in framework .NET V4.0",
provider.DbMetadata.ProductName);
AssertCommonSqlServerErrorCodes(provider);
}
private static void AssertCommonSqlServerErrorCodes(IDbProvider provider)
{
ErrorCodes codes = provider.DbMetadata.ErrorCodes;