Skip to content

Commit 4c5ad2a

Browse files
committed
#143: Update readme
1 parent 6b772fe commit 4c5ad2a

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,34 @@ public class MyContext : DbContext
119119
}
120120
```
121121

122+
### .NET Core example
123+
124+
Add the following package references.
125+
```xml
126+
<PackageReference Include="System.Data.SQLite" Version="1.0.112.2" />
127+
<PackageReference Include="System.Data.SQLite.EF6" Version="1.0.112.2" />
128+
```
129+
130+
Add the following class.
131+
```csharp
132+
public Configuration()
133+
{
134+
SetProviderFactory("System.Data.SQLite", SQLiteFactory.Instance);
135+
SetProviderFactory("System.Data.SQLite.EF6", SQLiteProviderFactory.Instance);
136+
137+
var providerServices = (DbProviderServices)SQLiteProviderFactory.Instance.GetService(typeof(DbProviderServices));
138+
139+
SetProviderServices("System.Data.SQLite", providerServices);
140+
SetProviderServices("System.Data.SQLite.EF6", providerServices);
141+
142+
SetDefaultConnectionFactory(this);
143+
}
144+
145+
public DbConnection CreateConnection(string connectionString)
146+
=> new SQLiteConnection(connectionString);
147+
}
148+
```
149+
122150
## Structure
123151

124152
The code is written in an extensible way.

0 commit comments

Comments
 (0)