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