forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSqlCe40ProviderAttribute.cs
More file actions
31 lines (29 loc) · 964 Bytes
/
SqlCe40ProviderAttribute.cs
File metadata and controls
31 lines (29 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Data.SqlServerCe;
using Simple.Data.Ado;
namespace Simple.Data.SqlCe40
{
public class SqlCe40ProviderAttribute : ProviderAssemblyAttributeBase
{
public SqlCe40ProviderAttribute() : base("sdf", "System.Data.SqlServerCe", "System.Data.SqlServerCe.4.0")
{
}
public override bool TryGetProvider(string connectionString, out IConnectionProvider provider, out Exception exception)
{
try
{
var _ = new SqlCeConnectionStringBuilder(connectionString);
provider = new SqlCe40ConnectionProvider();
provider.SetConnectionString(connectionString);
exception = null;
return true;
}
catch (Exception ex)
{
exception = ex;
provider = null;
return false;
}
}
}
}