1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-01 08:22:35 +01:00
Sonarr/NzbDrone.SqlCe/SqlCeProxy.cs

28 lines
647 B
C#
Raw Normal View History

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-16 23:44:35 +01:00
public SqlCeConnection EnsureDatabase(string connectionString)
2013-02-16 22:10:20 +01:00
{
2013-02-16 23:44:35 +01:00
var connection = new SqlCeConnection(connectionString);
2013-02-16 22:10:20 +01:00
if (!File.Exists(connection.Database))
{
2013-02-16 23:44:35 +01:00
var engine = new SqlCeEngine(connectionString);
2013-02-16 22:10:20 +01:00
engine.CreateDatabase();
}
2013-02-16 23:44:35 +01:00
return connection;
2013-02-16 22:10:20 +01:00
}
public DbProviderFactory GetSqlCeProviderFactory()
{
return new SqlCeProviderFactory();
}
}
}