diff --git a/NzbDrone.Core/Datastore/ConnectionFactory.cs b/NzbDrone.Core/Datastore/ConnectionFactory.cs index 127862eb1..35a131ab2 100644 --- a/NzbDrone.Core/Datastore/ConnectionFactory.cs +++ b/NzbDrone.Core/Datastore/ConnectionFactory.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Configuration; using System.Data.Common; +using System.Data.OleDb; +using System.Data.SqlClient; using System.Reflection; using NLog; using NzbDrone.Common; @@ -19,6 +21,10 @@ static ConnectionFactory() { Database.Mapper = new CustomeMapper(); + +#if __MonoCS__ +#else + var dataSet = (System.Data.DataSet)ConfigurationManager.GetSection("system.data"); dataSet.Tables[0].Rows.Add("Microsoft SQL Server Compact Data Provider 4.0" , "System.Data.SqlServerCe.4.0" @@ -29,6 +35,7 @@ static ConnectionFactory() var instance = Activator.CreateInstance(proxyType); var factoryMethod = proxyType.GetMethod("GetSqlCeProviderFactory"); _factory = (DbProviderFactory)factoryMethod.Invoke(instance, null); +#endif } @@ -76,6 +83,10 @@ public IDatabase GetLogPetaPocoDb(Boolean profiled = true) public static IDatabase GetPetaPocoDb(string connectionString, Boolean profiled = true) { +#if __MonoCS__ + throw new NotSupportedException("SqlCe is not supported in mono"); +#endif + lock (initilized) { if (!initilized.Contains(connectionString)) diff --git a/NzbDrone.Core/Datastore/MigrationsHelper.cs b/NzbDrone.Core/Datastore/MigrationsHelper.cs index 801ce1ed5..5d0c41f6f 100644 --- a/NzbDrone.Core/Datastore/MigrationsHelper.cs +++ b/NzbDrone.Core/Datastore/MigrationsHelper.cs @@ -1,6 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Data.SqlServerCe; +using System.Linq; +using System; using System.IO; using System.Reflection; using NLog; @@ -46,13 +45,7 @@ public static void Run(string connectionString, bool trace) private static void EnsureDatabase(string constr) { - var connection = new SqlCeConnection(constr); - - if (!File.Exists(connection.Database)) - { - var engine = new SqlCeEngine(constr); - engine.CreateDatabase(); - } + } public static string GetIndexName(string tableName, params string[] columns) diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 59632f165..992d6816d 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -91,7 +91,7 @@ true bin\Debug\ - DEBUG;TRACE + TRACE;DEBUG;Mono full x86 bin\Debug\SABSync.exe.CodeAnalysisLog.xml @@ -174,9 +174,6 @@ False ..\Libraries\Migrator.NET\Migrator.Providers.dll - - ..\packages\MiniProfiler.2.0.2\lib\net40\MiniProfiler.dll - False ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll @@ -206,10 +203,6 @@ - - True - ..\packages\Microsoft.SqlServer.Compact.4.0.8876.1\lib\net40\System.Data.SqlServerCe.dll - @@ -238,41 +231,41 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -293,7 +286,6 @@ - @@ -675,12 +667,7 @@ -if not exist "$(TargetDir)x86" md "$(TargetDir)x86" -xcopy /s /y "$(SolutionDir)packages\SqlServerCompact.4.0.8482.1\NativeBinaries\x86\*.*" "$(TargetDir)x86" - if not exist "$(TargetDir)x86" md "$(TargetDir)x86" - xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\x86\*.*" "$(TargetDir)x86" - if not exist "$(TargetDir)amd64" md "$(TargetDir)amd64" - xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\amd64\*.*" "$(TargetDir)amd64" + + \ No newline at end of file diff --git a/NzbDrone.SqlCe/SqlCeProxy.cs b/NzbDrone.SqlCe/SqlCeProxy.cs new file mode 100644 index 000000000..fb405083a --- /dev/null +++ b/NzbDrone.SqlCe/SqlCeProxy.cs @@ -0,0 +1,25 @@ +using System.Data.Common; +using System.Data.SqlServerCe; +using System.IO; + +namespace NzbDrone.SqlCe +{ + public class SqlCeProxy + { + public void EnsureDatabase(string constr) + { + var connection = new SqlCeConnection(constr); + + if (!File.Exists(connection.Database)) + { + var engine = new SqlCeEngine(constr); + engine.CreateDatabase(); + } + } + + public DbProviderFactory GetSqlCeProviderFactory() + { + return new SqlCeProviderFactory(); + } + } +} diff --git a/NzbDrone.SqlCe/packages.config b/NzbDrone.SqlCe/packages.config new file mode 100644 index 000000000..6325a733e --- /dev/null +++ b/NzbDrone.SqlCe/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 723b697a4..4ce372572 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -152,10 +152,6 @@ 3.5 - - True - ..\packages\Microsoft.SqlServer.Compact.4.0.8876.1\lib\net40\System.Data.SqlServerCe.dll - @@ -450,15 +446,6 @@ - - - - - - - - - @@ -832,7 +819,7 @@ if not exist "$(TargetDir)x86" md "$(TargetDir)x86" -xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\x86\*.*" "$(TargetDir)x86" +xcopy /s /y "$(SolutionDir)\SqlCe\*.*" "$(TargetDir)" \ No newline at end of file diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest b/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest deleted file mode 100644 index 27e5c654e..000000000 --- a/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest +++ /dev/null @@ -1,6 +0,0 @@ - - - - - +CXED+6HzJlSphyMNOn27ujadC0= MyKED+9DyS+1XcMeaC0Zlw2vFZ0= EeyDE7og6WoPd2oBhYbMEnpFHhY= - \ No newline at end of file diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/README_ENU.txt b/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/README_ENU.txt deleted file mode 100644 index fc38b3684..000000000 Binary files a/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/README_ENU.txt and /dev/null differ diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/msvcr90.dll b/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/msvcr90.dll deleted file mode 100644 index e2e66019c..000000000 Binary files a/NzbDrone.Web/_bin_deployableAssemblies/x86/Microsoft.VC90.CRT/msvcr90.dll and /dev/null differ diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceca40.dll b/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceca40.dll deleted file mode 100644 index 92596101e..000000000 Binary files a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceca40.dll and /dev/null differ diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlcecompact40.dll b/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlcecompact40.dll deleted file mode 100644 index 41c69ecc5..000000000 Binary files a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlcecompact40.dll and /dev/null differ diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceer40EN.dll b/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceer40EN.dll deleted file mode 100644 index a40154fd3..000000000 Binary files a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceer40EN.dll and /dev/null differ diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceme40.dll b/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceme40.dll deleted file mode 100644 index d737119fa..000000000 Binary files a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceme40.dll and /dev/null differ diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceqp40.dll b/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceqp40.dll deleted file mode 100644 index dedfc9a3c..000000000 Binary files a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlceqp40.dll and /dev/null differ diff --git a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlcese40.dll b/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlcese40.dll deleted file mode 100644 index cc37e3b54..000000000 Binary files a/NzbDrone.Web/_bin_deployableAssemblies/x86/sqlcese40.dll and /dev/null differ diff --git a/NzbDrone.Web/packages.config b/NzbDrone.Web/packages.config index 7211dda9d..3184e9642 100644 --- a/NzbDrone.Web/packages.config +++ b/NzbDrone.Web/packages.config @@ -23,7 +23,6 @@ - diff --git a/NzbDrone.ncrunchsolution b/NzbDrone.ncrunchsolution index 13efc6321..e88d63cdb 100644 --- a/NzbDrone.ncrunchsolution +++ b/NzbDrone.ncrunchsolution @@ -1,6 +1,6 @@ 1 - True + False true true UseDynamicAnalysis diff --git a/NzbDrone.sln b/NzbDrone.sln index 4667da249..8d66a2e59 100644 --- a/NzbDrone.sln +++ b/NzbDrone.sln @@ -60,6 +60,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution JSLintOptions.xml = JSLintOptions.xml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.SqlCe", "NzbDrone.SqlCe\NzbDrone.SqlCe.csproj", "{64E5482F-0C4F-46C6-9377-699D3EADBA9E}" +EndProject Global GlobalSection(JSLint) = preSolution SolutionConfigurationLocation = JSLintOptions.xml @@ -564,6 +566,30 @@ Global {A675DE45-D30A-4CAC-991A-34DA56947DD7}.Services|Mixed Platforms.Build.0 = Release|Any CPU {A675DE45-D30A-4CAC-991A-34DA56947DD7}.Services|x64.ActiveCfg = Release|Any CPU {A675DE45-D30A-4CAC-991A-34DA56947DD7}.Services|x86.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Debug|x64.ActiveCfg = Debug|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Debug|x86.ActiveCfg = Debug|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Pilot|Any CPU.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Pilot|Any CPU.Build.0 = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Pilot|Mixed Platforms.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Pilot|Mixed Platforms.Build.0 = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Pilot|x64.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Pilot|x86.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Release|Any CPU.Build.0 = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Release|x64.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Release|x86.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Services|Any CPU.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Services|Any CPU.Build.0 = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Services|Mixed Platforms.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Services|Mixed Platforms.Build.0 = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Services|x64.ActiveCfg = Release|Any CPU + {64E5482F-0C4F-46C6-9377-699D3EADBA9E}.Services|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE