2013-02-16 22:10:20 +01:00
|
|
|
using System.Data.Common;
|
|
|
|
using System.Data.SqlServerCe;
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
namespace NzbDrone.SqlCe
|
|
|
|
{
|
|
|
|
public class SqlCeProxy
|
|
|
|
{
|
2013-02-17 00:19:09 +01:00
|
|
|
public void EnsureDatabase(string constr)
|
2013-02-16 22:10:20 +01:00
|
|
|
{
|
2013-02-17 00:19:09 +01:00
|
|
|
var connection = new SqlCeConnection(constr);
|
2013-02-16 22:10:20 +01:00
|
|
|
|
|
|
|
if (!File.Exists(connection.Database))
|
|
|
|
{
|
2013-02-17 00:19:09 +01:00
|
|
|
var engine = new SqlCeEngine(constr);
|
2013-02-16 22:10:20 +01:00
|
|
|
engine.CreateDatabase();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public DbProviderFactory GetSqlCeProviderFactory()
|
|
|
|
{
|
|
|
|
return new SqlCeProviderFactory();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|