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