2011-08-28 17:43:33 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using System.Data.SqlServerCe;
|
2011-09-08 01:56:00 +00:00
|
|
|
|
using MvcMiniProfiler;
|
2011-08-28 17:43:33 +00:00
|
|
|
|
using MvcMiniProfiler.Data;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|