mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 13:10:13 -07:00
added conditional compile for mono
This commit is contained in:
parent
00e2f225f8
commit
3ab04fd213
19 changed files with 40 additions and 57 deletions
|
@ -28,6 +28,10 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
public CentralDispatchFixture()
|
public CentralDispatchFixture()
|
||||||
{
|
{
|
||||||
|
#if __MonoCS__
|
||||||
|
throw new IgnoreException("SqlCe is not supported");
|
||||||
|
#endif
|
||||||
|
|
||||||
InitLogging();
|
InitLogging();
|
||||||
var dispatch = new CentralDispatch();
|
var dispatch = new CentralDispatch();
|
||||||
kernel = dispatch.BuildContainer();
|
kernel = dispatch.BuildContainer();
|
||||||
|
|
|
@ -16,6 +16,11 @@ namespace NzbDrone.Core.Test.Framework
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void CoreTestSetup()
|
public void CoreTestSetup()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if __MonoCS__
|
||||||
|
throw new IgnoreException("SqlCe is not supported in mono.");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (NCrunch.Framework.NCrunchEnvironment.NCrunchIsResident())
|
if (NCrunch.Framework.NCrunchEnvironment.NCrunchIsResident())
|
||||||
{
|
{
|
||||||
_dbTemplateName = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()) + ".sdf";
|
_dbTemplateName = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()) + ".sdf";
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Core.Datastore;
|
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
|
|
@ -131,10 +131,6 @@
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Data.Entity" />
|
<Reference Include="System.Data.Entity" />
|
||||||
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
|
||||||
<Private>True</Private>
|
|
||||||
<HintPath>..\packages\Microsoft.SqlServer.Compact.4.0.8876.1\lib\net40\System.Data.SqlServerCe.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.ServiceModel" />
|
<Reference Include="System.ServiceModel" />
|
||||||
<Reference Include="System.Transactions" />
|
<Reference Include="System.Transactions" />
|
||||||
|
@ -428,7 +424,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>if not exist "$(TargetDir)x86" md "$(TargetDir)x86"
|
<PostBuildEvent>if not exist "$(TargetDir)x86" md "$(TargetDir)x86"
|
||||||
xcopy /s /y "$(SolutionDir)packages\Microsoft.SqlServer.Compact.4.0.8876.1\NativeBinaries\x86\*.*" "$(TargetDir)x86"</PostBuildEvent>
|
xcopy /s /y "$(SolutionDir)\SqlCe\*.*" "$(TargetDir)"</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
<package id="CommonServiceLocator" version="1.0" targetFramework="net40" />
|
<package id="CommonServiceLocator" version="1.0" targetFramework="net40" />
|
||||||
<package id="EloqueraDB" version="5.0.0" targetFramework="net40" />
|
<package id="EloqueraDB" version="5.0.0" targetFramework="net40" />
|
||||||
<package id="FluentAssertions" version="2.0.0.1" targetFramework="net40" />
|
<package id="FluentAssertions" version="2.0.0.1" targetFramework="net40" />
|
||||||
<package id="Microsoft.SqlServer.Compact" version="4.0.8876.1" targetFramework="net40" />
|
|
||||||
<package id="Moq" version="4.0.10827" />
|
<package id="Moq" version="4.0.10827" />
|
||||||
<package id="NBuilder" version="3.0.1.1" />
|
<package id="NBuilder" version="3.0.1.1" />
|
||||||
<package id="NCrunch.Framework" version="1.43.0.23" targetFramework="net40" />
|
<package id="NCrunch.Framework" version="1.43.0.23" targetFramework="net40" />
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Data.SqlServerCe;
|
using System.Data.Common;
|
||||||
using System.IO;
|
using System.Reflection;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using PetaPoco;
|
using PetaPoco;
|
||||||
|
@ -14,6 +13,7 @@ namespace NzbDrone.Core.Datastore
|
||||||
{
|
{
|
||||||
private readonly EnvironmentProvider _environmentProvider;
|
private readonly EnvironmentProvider _environmentProvider;
|
||||||
private static readonly Logger logger = LogManager.GetLogger("ConnectionFactory");
|
private static readonly Logger logger = LogManager.GetLogger("ConnectionFactory");
|
||||||
|
private static readonly DbProviderFactory _factory;
|
||||||
|
|
||||||
static ConnectionFactory()
|
static ConnectionFactory()
|
||||||
{
|
{
|
||||||
|
@ -24,8 +24,15 @@ namespace NzbDrone.Core.Datastore
|
||||||
, "System.Data.SqlServerCe.4.0"
|
, "System.Data.SqlServerCe.4.0"
|
||||||
, ".NET Framework Data Provider for Microsoft SQL Server Compact"
|
, ".NET Framework Data Provider for Microsoft SQL Server Compact"
|
||||||
, "System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
|
, "System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");
|
||||||
|
|
||||||
|
var proxyType = Assembly.Load("NzbDrone.SqlCe").GetExportedTypes()[0];
|
||||||
|
var instance = Activator.CreateInstance(proxyType);
|
||||||
|
var factoryMethod = proxyType.GetMethod("GetSqlCeProviderFactory");
|
||||||
|
_factory = (DbProviderFactory)factoryMethod.Invoke(instance, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ConnectionFactory(EnvironmentProvider environmentProvider)
|
public ConnectionFactory(EnvironmentProvider environmentProvider)
|
||||||
{
|
{
|
||||||
_environmentProvider = environmentProvider;
|
_environmentProvider = environmentProvider;
|
||||||
|
@ -66,24 +73,22 @@ namespace NzbDrone.Core.Datastore
|
||||||
static readonly HashSet<String> initilized = new HashSet<string>();
|
static readonly HashSet<String> initilized = new HashSet<string>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static IDatabase GetPetaPocoDb(string connectionString, Boolean profiled = true)
|
public static IDatabase GetPetaPocoDb(string connectionString, Boolean profiled = true)
|
||||||
{
|
{
|
||||||
lock (initilized)
|
lock (initilized)
|
||||||
{
|
{
|
||||||
if (!initilized.Contains(connectionString))
|
if (!initilized.Contains(connectionString))
|
||||||
{
|
{
|
||||||
VerifyDatabase(connectionString);
|
//VerifyDatabase(connectionString);
|
||||||
MigrationsHelper.Run(connectionString, true);
|
MigrationsHelper.Run(connectionString, true);
|
||||||
initilized.Add(connectionString);
|
initilized.Add(connectionString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var factory = new DbProviderFactory
|
|
||||||
{
|
|
||||||
IsProfiled = profiled
|
|
||||||
};
|
|
||||||
|
|
||||||
var db = new Database(connectionString, factory, Database.DBType.SqlServerCE)
|
|
||||||
|
var db = new Database(connectionString, _factory, Database.DBType.SqlServerCE)
|
||||||
{
|
{
|
||||||
KeepConnectionAlive = true,
|
KeepConnectionAlive = true,
|
||||||
ForceDateTimesToUtc = false,
|
ForceDateTimesToUtc = false,
|
||||||
|
@ -92,7 +97,7 @@ namespace NzbDrone.Core.Datastore
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void VerifyDatabase(string connectionString)
|
/*private static void VerifyDatabase(string connectionString)
|
||||||
{
|
{
|
||||||
logger.Debug("Verifying database {0}", connectionString);
|
logger.Debug("Verifying database {0}", connectionString);
|
||||||
|
|
||||||
|
@ -145,6 +150,6 @@ namespace NzbDrone.Core.Datastore
|
||||||
//TODO: do db cleanup to avoid broken relationships.
|
//TODO: do db cleanup to avoid broken relationships.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Data.Common;
|
|
||||||
using System.Data.SqlServerCe;
|
|
||||||
using StackExchange.Profiling;
|
|
||||||
using StackExchange.Profiling.Data;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Datastore
|
|
||||||
{
|
|
||||||
class DbProviderFactory : System.Data.Common.DbProviderFactory
|
|
||||||
{
|
|
||||||
public Boolean IsProfiled { get; set; }
|
|
||||||
|
|
||||||
public override DbConnection CreateConnection()
|
|
||||||
{
|
|
||||||
var sqliteConnection = new SqlCeConnection();
|
|
||||||
DbConnection connection = sqliteConnection;
|
|
||||||
|
|
||||||
if (IsProfiled)
|
|
||||||
{
|
|
||||||
connection = new ProfiledDbConnection(sqliteConnection, MiniProfiler.Current);
|
|
||||||
}
|
|
||||||
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Data.SqlServerCe;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Migrator.Framework;
|
using Migrator.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
@ -35,8 +35,7 @@ namespace NzbDrone.Core.Datastore.Migrations
|
||||||
|
|
||||||
protected EloqueraDb GetObjectDb()
|
protected EloqueraDb GetObjectDb()
|
||||||
{
|
{
|
||||||
|
var sqlCeConnection = new SqlConnection(Database.ConnectionString);
|
||||||
var sqlCeConnection = new SqlCeConnection(Database.ConnectionString);
|
|
||||||
|
|
||||||
var eqPath = sqlCeConnection.Database.Replace(".sdf", ".eq");
|
var eqPath = sqlCeConnection.Database.Replace(".sdf", ".eq");
|
||||||
return new EloqueraDbFactory(new EnvironmentProvider()).Create(eqPath);
|
return new EloqueraDbFactory(new EnvironmentProvider()).Create(eqPath);
|
||||||
|
|
|
@ -9,7 +9,6 @@ using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.DecisionEngine;
|
using NzbDrone.Core.Providers.DecisionEngine;
|
||||||
using NzbDrone.Core.Providers.Indexer;
|
using NzbDrone.Core.Providers.Indexer;
|
||||||
using StackExchange.Profiling;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Jobs
|
namespace NzbDrone.Core.Jobs
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,11 @@
|
||||||
</system.diagnostics>
|
</system.diagnostics>
|
||||||
<system.web>
|
<system.web>
|
||||||
<trust level="Full" originUrl=".*" />
|
<trust level="Full" originUrl=".*" />
|
||||||
<compilation debug="true" targetFramework="4.0" />
|
<compilation debug="true" targetFramework="4.0">
|
||||||
|
<assemblies>
|
||||||
|
<add assembly="NzbDrone.SqlCe" />
|
||||||
|
</assemblies>
|
||||||
|
</compilation>
|
||||||
<pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
<pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||||
<controls>
|
<controls>
|
||||||
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||||
|
@ -88,12 +92,6 @@
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
<system.data>
|
|
||||||
<DbProviderFactories>
|
|
||||||
<remove invariant="System.Data.SqlServerCe.4.0" />
|
|
||||||
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
|
|
||||||
</DbProviderFactories>
|
|
||||||
</system.data>
|
|
||||||
<location path="api" allowOverride="false">
|
<location path="api" allowOverride="false">
|
||||||
<system.web>
|
<system.web>
|
||||||
<customErrors mode="Off" />
|
<customErrors mode="Off" />
|
||||||
|
|
6
SqlCe/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
Normal file
6
SqlCe/x86/Microsoft.VC90.CRT/Microsoft.VC90.CRT.manifest
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||||
|
<noInheritable></noInheritable>
|
||||||
|
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.30729.4148" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
|
||||||
|
<file name="msvcr90.dll" hashalg="SHA1" hash="98e8006e0a4542e69f1a3555b927758bd76ca07d"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>+CXED+6HzJlSphyMNOn27ujadC0=</dsig:DigestValue></asmv2:hash></file> <file name="msvcp90.dll" hashalg="SHA1" hash="3aec3be680024a46813dee891a753bd58b3f3b12"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>MyKED+9DyS+1XcMeaC0Zlw2vFZ0=</dsig:DigestValue></asmv2:hash></file> <file name="msvcm90.dll" hashalg="SHA1" hash="0195dd0896d74b62531e4f3c771904a3d996450e"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>EeyDE7og6WoPd2oBhYbMEnpFHhY=</dsig:DigestValue></asmv2:hash></file>
|
||||||
|
</assembly>
|
BIN
SqlCe/x86/Microsoft.VC90.CRT/README_ENU.txt
Normal file
BIN
SqlCe/x86/Microsoft.VC90.CRT/README_ENU.txt
Normal file
Binary file not shown.
BIN
SqlCe/x86/Microsoft.VC90.CRT/msvcr90.dll
Normal file
BIN
SqlCe/x86/Microsoft.VC90.CRT/msvcr90.dll
Normal file
Binary file not shown.
BIN
SqlCe/x86/sqlceca40.dll
Normal file
BIN
SqlCe/x86/sqlceca40.dll
Normal file
Binary file not shown.
BIN
SqlCe/x86/sqlcecompact40.dll
Normal file
BIN
SqlCe/x86/sqlcecompact40.dll
Normal file
Binary file not shown.
BIN
SqlCe/x86/sqlceer40EN.dll
Normal file
BIN
SqlCe/x86/sqlceer40EN.dll
Normal file
Binary file not shown.
BIN
SqlCe/x86/sqlceme40.dll
Normal file
BIN
SqlCe/x86/sqlceme40.dll
Normal file
Binary file not shown.
BIN
SqlCe/x86/sqlceqp40.dll
Normal file
BIN
SqlCe/x86/sqlceqp40.dll
Normal file
Binary file not shown.
BIN
SqlCe/x86/sqlcese40.dll
Normal file
BIN
SqlCe/x86/sqlcese40.dll
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue