2011-08-28 17:43:33 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using System.Data.SqlServerCe;
|
2012-07-27 22:15:28 +00:00
|
|
|
|
using StackExchange.Profiling;
|
|
|
|
|
using StackExchange.Profiling.Data;
|
2011-08-28 17:43:33 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Datastore
|
|
|
|
|
{
|
2011-11-23 05:58:26 +00:00
|
|
|
|
class DbProviderFactory : System.Data.Common.DbProviderFactory
|
2011-08-28 17:43:33 +00:00
|
|
|
|
{
|
|
|
|
|
public Boolean IsProfiled { get; set; }
|
|
|
|
|
|
|
|
|
|
public override DbConnection CreateConnection()
|
|
|
|
|
{
|
|
|
|
|
var sqliteConnection = new SqlCeConnection();
|
|
|
|
|
DbConnection connection = sqliteConnection;
|
|
|
|
|
|
|
|
|
|
if (IsProfiled)
|
|
|
|
|
{
|
2011-09-08 01:56:00 +00:00
|
|
|
|
connection = new ProfiledDbConnection(sqliteConnection, MiniProfiler.Current);
|
2011-08-28 17:43:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return connection;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|