Permalink
Browse files

Harmonization of Devart changes with the Oracle Provider through supp…

…orting different project configurations
  • Loading branch information...
1 parent d39a3a9 commit b60f339299adc0cd46a2c4392a914b166b77ff3f @flq flq committed Sep 5, 2011
@@ -83,9 +83,9 @@ public void self_join()
Assert.AreEqual(106, employees.Count); // The top man is missing
- var kings_subordinates = employees.Where(e => e.Manager == "King").ToList();
+ var kingsSubordinates = employees.Where(e => e.Manager == "King").ToList();
- Assert.AreEqual(14, kings_subordinates.Count);
+ Assert.AreEqual(14, kingsSubordinates.Count);
}
[Test]
@@ -99,5 +99,19 @@ public void filtered_self_join()
Assert.IsTrue(employees.All(e => e.Manager.Equals("King")));
}
+
+ [Test,Ignore("Currently fails with stack overflow")]
+ public void page_with_total_count()
+ {
+ Promise<int> count;
+ List<dynamic> list = _db.Employees.QueryByEmployeeId(100.to(125))
+ .Take(10)
+ .WithTotalCount(out count)
+ .ToList();
+
+ Assert.IsTrue(count.HasValue);
+ Assert.AreEqual(10, list.Count);
+ Assert.AreEqual(25, count);
+ }
}
}
@@ -1,22 +1,32 @@
using System.Configuration;
-using Devart.Data.Oracle;
using Simple.Data.Ado.Schema;
using System.Collections.Generic;
using System.Linq;
+#if DEVART
+using Devart.Data.Oracle;
+#else
+using Oracle.DataAccess.Client;
+#endif
namespace Simple.Data.Oracle.Tests
{
internal class OracleConnectivityContext
{
+ #if DEVART
+ const string ConnectionName = "DevartOracle";
+ #endif
+ #if !DEVART
+ const string ConnectionName = "OracleClient";
+ #endif
+
protected dynamic _db;
protected string _connectionString;
protected string _providerName;
public OracleConnectivityContext()
{
- string connectionName = "DevartOracle";
- _connectionString = ConfigurationManager.ConnectionStrings[connectionName].ConnectionString;
- _providerName = ConfigurationManager.ConnectionStrings[connectionName].ProviderName;
+ _connectionString = ConfigurationManager.ConnectionStrings[ConnectionName].ConnectionString;
+ _providerName = ConfigurationManager.ConnectionStrings[ConnectionName].ProviderName;
}
protected void InitDynamicDB()
@@ -1,8 +1,9 @@
using System;
using System.Data;
-using System.Diagnostics;
using NUnit.Framework;
+#if DEVART
using Devart.Data.Oracle;
+#endif
namespace Simple.Data.Oracle.Tests
{
@@ -22,6 +22,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DevartDebug|AnyCPU' ">
+ <UseDevartProvider>True</UseDevartProvider>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\DevartDebug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;DEVART</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
@@ -30,15 +40,28 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DevartRelease|AnyCPU' ">
+ <UseDevartProvider>True</UseDevartProvider>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\DevartRelease\</OutputPath>
+ <DefineConstants>TRACE;DEVART</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
<ItemGroup>
- <Reference Include="Devart.Data, Version=5.0.302.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
+ <Reference Include="Devart.Data, Version=5.0.302.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL" Condition=" '$(UseDevartProvider)' == 'True' ">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Devart\dotConnect\Oracle\Devart.Data.dll</HintPath>
</Reference>
- <Reference Include="Devart.Data.Oracle, Version=6.30.202.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
+ <Reference Include="Devart.Data.Oracle, Version=6.30.202.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL" Condition=" '$(UseDevartProvider)' == 'True' ">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Devart.Data.Oracle.dll</HintPath>
</Reference>
+ <Reference Include="Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342" Condition=" '$(UseDevartProvider)' != 'True' ">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\Oracle.DataAccess.dll</HintPath>
+ </Reference>
<Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
View
@@ -14,16 +14,26 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
+ DevartDebug|Any CPU = DevartDebug|Any CPU
+ DevartRelease|Any CPU = DevartRelease|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C4E1B507-9F39-43A6-B698-CB2DC77F0808}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4E1B507-9F39-43A6-B698-CB2DC77F0808}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C4E1B507-9F39-43A6-B698-CB2DC77F0808}.DevartDebug|Any CPU.ActiveCfg = DevartDebug|Any CPU
+ {C4E1B507-9F39-43A6-B698-CB2DC77F0808}.DevartDebug|Any CPU.Build.0 = DevartDebug|Any CPU
{C4E1B507-9F39-43A6-B698-CB2DC77F0808}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4E1B507-9F39-43A6-B698-CB2DC77F0808}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C4E1B507-9F39-43A6-B698-CB2DC77F0808}.DevartRelease|Any CPU.ActiveCfg = DevartRelease|Any CPU
+ {C4E1B507-9F39-43A6-B698-CB2DC77F0808}.DevartRelease|Any CPU.Build.0 = DevartRelease|Any CPU
{2B0282A8-C783-4E0C-BC26-1EC3FBA6DB79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2B0282A8-C783-4E0C-BC26-1EC3FBA6DB79}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2B0282A8-C783-4E0C-BC26-1EC3FBA6DB79}.DevartDebug|Any CPU.ActiveCfg = DevartDebug|Any CPU
+ {2B0282A8-C783-4E0C-BC26-1EC3FBA6DB79}.DevartDebug|Any CPU.Build.0 = DevartDebug|Any CPU
{2B0282A8-C783-4E0C-BC26-1EC3FBA6DB79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2B0282A8-C783-4E0C-BC26-1EC3FBA6DB79}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2B0282A8-C783-4E0C-BC26-1EC3FBA6DB79}.DevartRelease|Any CPU.ActiveCfg = DevartRelease|Any CPU
+ {2B0282A8-C783-4E0C-BC26-1EC3FBA6DB79}.DevartRelease|Any CPU.Build.0 = DevartRelease|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1,9 +1,15 @@
using System;
using System.Collections.Generic;
using System.Data;
-using Devart.Data.Oracle;
using Simple.Data.Ado.Schema;
using System.Linq;
+#if DEVART
+using Devart.Data.Oracle;
+#endif
+#if !DEVART
+using Oracle.DataAccess.Client;
+#endif
+
namespace Simple.Data.Oracle
{
@@ -1,13 +1,20 @@
-using System;
-using System.ComponentModel.Composition;
+using System.ComponentModel.Composition;
using System.Data;
-using Devart.Data.Oracle;
using Simple.Data.Ado;
using Simple.Data.Ado.Schema;
+#if DEVART
+using Devart.Data.Oracle;
+#else
+using Oracle.DataAccess.Client;
+#endif
namespace Simple.Data.Oracle
{
+ #if DEVART
[Export("Devart.Data.Oracle", typeof(IConnectionProvider))]
+ #else
+ [Export("Oracle.DataAccess.Client", typeof(IConnectionProvider))]
+ #endif
internal class OracleConnectionProvider : IConnectionProvider
{
@@ -56,7 +63,16 @@ internal OracleConnection CreateOracleConnection()
internal string UserOfConnection
{
- get { return ConnectionString != null ? new OracleConnectionStringBuilder(ConnectionString).UserId.ToUpperInvariant() : null; }
+ get { return ConnectionString != null ? UserIdOfConnection() : null; }
+ }
+
+ private string UserIdOfConnection()
+ {
+ #if !DEVART
+ return new OracleConnectionStringBuilder(ConnectionString).UserID.ToUpperInvariant();
+ #else
+ return new OracleConnectionStringBuilder(ConnectionString).UserId.ToUpperInvariant();
+ #endif
}
}
}
@@ -4,10 +4,14 @@
using System.Data.Common;
using System.Diagnostics;
using System.Linq;
-using Devart.Data.Oracle;
using Simple.Data.Ado;
using Simple.Data.Ado.Schema;
using ResultSet = System.Collections.Generic.IEnumerable<System.Collections.Generic.IDictionary<string, object>>;
+#if DEVART
+using Devart.Data.Oracle;
+#else
+using Oracle.DataAccess.Client;
+#endif
namespace Simple.Data.Oracle
{
@@ -22,6 +22,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DevartDebug|AnyCPU' ">
+ <UseDevartProvider>True</UseDevartProvider>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\DevartDebug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE;DEVART</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
@@ -30,15 +40,28 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DevartRelease|AnyCPU' ">
+ <UseDevartProvider>True</UseDevartProvider>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\DevartRelease\</OutputPath>
+ <DefineConstants>TRACE;DEVART</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
<ItemGroup>
- <Reference Include="Devart.Data, Version=5.0.302.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
+ <Reference Include="Devart.Data, Version=5.0.302.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL" Condition=" '$(UseDevartProvider)' == 'True' ">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Devart.Data.dll</HintPath>
</Reference>
- <Reference Include="Devart.Data.Oracle, Version=6.30.202.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
+ <Reference Include="Devart.Data.Oracle, Version=6.30.202.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL" Condition=" '$(UseDevartProvider)' == 'True' ">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Devart.Data.Oracle.dll</HintPath>
</Reference>
+ <Reference Include="Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342" Condition=" '$(UseDevartProvider)' != 'True' ">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\Oracle.DataAccess.dll</HintPath>
+ </Reference>
<Reference Include="Simple.Data, Version=0.9.3.2, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Simple.Data.Core.0.9.3.2\lib\net40\Simple.Data.dll</HintPath>
View
@@ -11,6 +11,12 @@ since it needs the native backend of the client. Add the native backend to your
The .NET dll. is then found under %INSTALL%\odp.net\bin\4 - copy it into the lib folder.
+#Devart Provider
+The solution is prepared to be compiled against the devart Oracle provider thanks to input from *Vagif Abilov*. For this some hokery-pokery is done
+in the solution and project files. You can switch from Debug/Release configurations to DevartDebug/DevartRelease. The changes in the config are
+- Definition of a compile flag _DEVART_
+- Referencing the corresponding devart assemblies which need to be in the lib folder
+
#Tests
Tests run against an XE installation with the pre-installed hr user activated. The connectstring can be found in the

0 comments on commit b60f339

Please sign in to comment.