You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- PrimaryKey constraint (`Key` annotation, key composites are supported)
15
15
- ForeignKey constraint (1-n relationships, support for 'Cascade on delete')
16
16
- Not Null constraint
17
17
- Auto increment (An int PrimaryKey will automatically be incremented)
18
+
- Index (Decorate columns with the `Index` attribute. Indices are automatically created for foreign keys by default. To prevent this you can remove the convetion `ForeignKeyIndexConvention`)
18
19
19
20
I tried to write the code in a extensible way.
20
-
The logic is divided into two main parts. Builder and Statement.
21
+
The logic is divided into two main parts, Builder and Statement.
21
22
The Builder knows how to translate the EdmModel into statements where a statement class creates the SQLite-DDL-Code.
22
23
The structure of the statements is influenced by the [SQLite Language Specification](https://www.sqlite.org/lang.html).
23
24
You will find an extensive usage of the composite pattern.
24
25
25
-
## How to use
26
-
Either get the assembly from the latest [release](https://github.com/msallin/SQLiteCodeFirst/releases) or install the NuGet-Package [SQLite.CodeFirst](https://www.nuget.org/packages/SQLite.CodeFirst/).
26
+
## Install
27
+
Either get the assembly from the latest [GitHub Release Page](https://github.com/msallin/SQLiteCodeFirst/releases) or install the NuGet-Package [SQLite.CodeFirst](https://www.nuget.org/packages/SQLite.CodeFirst/) (`PM> Install-Package SQLite.CodeFirst`).
28
+
29
+
The project is built to target.NET framework versions 4.0 and 4.5.
30
+
You can use the SQLite CodeFirst in projects that target the following frameworks:
31
+
- .NET 4.0 (use net40)
32
+
- .NET 4.5 (use net45)
33
+
- .NET 4.5.1 (use net45)
34
+
- .NET 4.5.2 (use net45)
27
35
28
-
If you want to let the Entity Framework create the database, if it does not exist, just set `SqliteDropCreateDatabaseAlways<>` or `SqliteCreateDatabaseIfNotExists<>` as your `IDbInitializer<>`.
36
+
## How to use
37
+
When you want to let the Entity Framework create database if it does not exist, just set `SqliteDropCreateDatabaseAlways<>` or `SqliteCreateDatabaseIfNotExists<>` as your `IDbInitializer<>`.
29
38
```csharp
30
39
publicclassMyDbContext : DbContext
31
40
{
@@ -34,21 +43,20 @@ public class MyDbContext : DbContext
In a more advanced scenario you may want to populate some core- or test-data after the database was created.
52
+
In a more advanced scenario, you may want to populate some core- or test-data after the database was created.
45
53
To do this, inherit from `SqliteDropCreateDatabaseAlways<>` or `SqliteCreateDatabaseIfNotExists<>` and override the `Seed(MyDbContext context)` function.
46
-
This function will be called, in a own transaction, right after the database was created. This function is only executed if a new database was successfully created.
54
+
This function will be called in a transaction once the database was created. This function is only executed if a new database was successfully created.
@@ -58,5 +66,9 @@ public class MyDbContextContextInitializer : SqliteDropCreateDatabaseAlways<MyDb
58
66
```
59
67
60
68
## Hints
69
+
<<<<<<< HEAD
61
70
If you try to reinstall the NuGet-Packages (e.g. if you want to downgrade to .NET 4.0) the app.config will be overwritten and you may getting an exception when you try to run the console project.
71
+
=======
72
+
If you try to reinstall the NuGet-Packages (e.g. if you want to downgrade to .NET 4.0), the app.config will be overwritten and you may getting an exception when you try to run the console project.
73
+
>>>>>>> refs/remotes/msallin/master
62
74
In this case please check the following issue: https://github.com/msallin/SQLiteCodeFirst/issues/13.
0 commit comments