-
-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathConfiguration.cs
More file actions
28 lines (23 loc) · 989 Bytes
/
Configuration.cs
File metadata and controls
28 lines (23 loc) · 989 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
using System.Data.Common;
using System.Data.Entity;
using System.Data.Entity.Core.Common;
using System.Data.Entity.Infrastructure;
using System.Data.SQLite;
using System.Data.SQLite.EF6;
namespace SQLite.CodeFirst.NetCore.Console
{
public class Configuration : DbConfiguration, IDbConnectionFactory
{
public Configuration()
{
SetProviderFactory("System.Data.SQLite", SQLiteFactory.Instance);
SetProviderFactory("System.Data.SQLite.EF6", SQLiteProviderFactory.Instance);
var providerServices = (DbProviderServices)SQLiteProviderFactory.Instance.GetService(typeof(DbProviderServices));
SetProviderServices("System.Data.SQLite", providerServices);
SetProviderServices("System.Data.SQLite.EF6", providerServices);
SetDefaultConnectionFactory(this);
}
public DbConnection CreateConnection(string connectionString)
=> new SQLiteConnection(connectionString);
}
}