1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-03-04 02:38:18 +00:00
Radarr/NzbDrone.SqlCe/SqlCeProxy.cs

28 lines
647 B
C#
Raw Normal View History

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