2011-08-28 10:43:33 -07:00
|
|
|
|
using System;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using System.Data.SqlServerCe;
|
2011-09-07 18:56:00 -07:00
|
|
|
|
using MvcMiniProfiler;
|
2011-08-28 10:43:33 -07:00
|
|
|
|
using MvcMiniProfiler.Data;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Datastore
|
|
|
|
|
{
|
2011-11-22 21:58:26 -08:00
|
|
|
|
class DbProviderFactory : System.Data.Common.DbProviderFactory
|
2011-08-28 10:43:33 -07:00
|
|
|
|
{
|
|
|
|
|
public Boolean IsProfiled { get; set; }
|
|
|
|
|
|
|
|
|
|
public override DbConnection CreateConnection()
|
|
|
|
|
{
|
|
|
|
|
var sqliteConnection = new SqlCeConnection();
|
|
|
|
|
DbConnection connection = sqliteConnection;
|
|
|
|
|
|
|
|
|
|
if (IsProfiled)
|
|
|
|
|
{
|
2011-09-07 18:56:00 -07:00
|
|
|
|
connection = new ProfiledDbConnection(sqliteConnection, MiniProfiler.Current);
|
2011-08-28 10:43:33 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return connection;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|