mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-28 04:51:45 +02:00
more dynamic binding to sqlce
This commit is contained in:
@@ -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,19 +21,22 @@ namespace NzbDrone.Core.Datastore
|
||||
{
|
||||
Database.Mapper = new CustomeMapper();
|
||||
|
||||
if (EnvironmentProvider.IsMono) return;
|
||||
|
||||
#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"
|
||||
, ".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.4.0"
|
||||
, ".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");
|
||||
|
||||
var proxyType = Assembly.Load("NzbDrone.SqlCe").GetExportedTypes()[0];
|
||||
var instance = Activator.CreateInstance(proxyType);
|
||||
var factoryMethod = proxyType.GetMethod("GetSqlCeProviderFactory");
|
||||
_factory = (DbProviderFactory)factoryMethod.Invoke(instance, null);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -78,10 +83,9 @@ namespace NzbDrone.Core.Datastore
|
||||
|
||||
public static IDatabase GetPetaPocoDb(string connectionString, Boolean profiled = true)
|
||||
{
|
||||
if (EnvironmentProvider.IsMono)
|
||||
{
|
||||
throw new NotSupportedException("SqlCe is not supported in mono");
|
||||
}
|
||||
#if __MonoCS__
|
||||
throw new NotSupportedException("SqlCe is not supported in mono");
|
||||
#endif
|
||||
|
||||
lock (initilized)
|
||||
{
|
||||
|
Reference in New Issue
Block a user