mirror of
https://github.com/Radarr/Radarr
synced 2024-12-24 00:42:38 +00:00
26 lines
682 B
C#
26 lines
682 B
C#
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;
|
|
}
|
|
}
|
|
}
|