Skip to content

Commit c82ff24

Browse files
committed
Fix some markdown issues in the read me and correct typos
1 parent 4073694 commit c82ff24

File tree

1 file changed

+30
-17
lines changed

1 file changed

+30
-17
lines changed

README.md

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
Creates a [SQLite Database](https://sqlite.org/) from Code, using [Entity Framework](https://msdn.microsoft.com/en-us/data/ef.aspx) CodeFirst.
88

99
## Support the project <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ARTMHALNW4VC6&lc=CH&item_name=SQLite%2eCodeFirst&item_number=sqlitecodefirst&currency_code=CHF&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted" title="Donate to this project using Paypal"><img src="https://camo.githubusercontent.com/11b2f47d7b4af17ef3a803f57c37de3ac82ac039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d79656c6c6f772e737667" alt="PayPal donate button" data-canonical-src="https://img.shields.io/badge/paypal-donate-yellow.svg" style="max-width:100%;"></a>
10+
1011
To support this project you can: *star the repository*, report bugs/request features by creating new issues, write code and create PRs or donate.
1112
Especially if you use it for a commercial project, a donation is welcome.
12-
If you need a specific feature for a commercial project, I am glad to offer a paid implementation.
13-
13+
If you need a specific feature for a commercial project, I am glad to offer a paid implementation.
1414

1515
## Features
16-
This Project ships several `IDbInitializer` classes. These create new SQLite Databases based on your model/code.
16+
17+
This project ships several `IDbInitializer` classes. These create new SQLite Databases based on your model/code.
1718

1819
The following features are supported:
20+
1921
- Tables from classes (supported annotations: `Table`)
2022
- Columns from properties (supported annotations: `Column`, `Key`, `MaxLength`, `Required`, `NotMapped`, `DatabaseGenerated`, `Index`)
2123
- PrimaryKey constraint (`Key` annotation, key composites are supported)
@@ -32,21 +34,24 @@ Either get the assembly from the latest [GitHub Release Page](https://github.com
3234

3335
The project is built to target .NET framework versions 4.0 and 4.5.
3436
You can use the SQLite CodeFirst in projects that target the following frameworks:
35-
- .NET 4.0 (use net40)
36-
- .NET 4.5 (use net45)
37-
- .NET 4.5.1 (use net45)
38-
- .NET 4.5.2 (use net45)
39-
- .NET 4.6 (use net45)
40-
- .NET 4.6.1 (use net45)
41-
- .NET 4.6.2 (use net45)
42-
- .NET 4.7 (use net45)
43-
- .NET 4.7.1 (use net45)
44-
- .NET 4.7.2 (use net45)
37+
38+
- .NET 4.0 (uses net40)
39+
- .NET 4.5 (uses net45)
40+
- .NET 4.5.1 (uses net45)
41+
- .NET 4.5.2 (uses net45)
42+
- .NET 4.6 (uses net45)
43+
- .NET 4.6.1 (uses net45)
44+
- .NET 4.6.2 (uses net45)
45+
- .NET 4.7 (uses net45)
46+
- .NET 4.7.1 (uses net45)
47+
- .NET 4.7.2 (uses net45)
4548
- .NET 4.8 (uses net45)
4649

4750
## How to use
51+
4852
The functionality is exposed by using implementations of the `IDbInitializer<>` interface.
4953
Depending on your need, you can choose from the following initializers:
54+
5055
- SqliteCreateDatabaseIfNotExists
5156
- SqliteDropCreateDatabaseAlways
5257
- SqliteDropCreateDatabaseWhenModelChanges
@@ -57,6 +62,7 @@ Or for even more control, use the `SqliteSqlGenerator` (implements `ISqlGenerato
5762
When you want to let the Entity Framework create database if it does not exist, just set `SqliteDropCreateDatabaseAlways<>` or `SqliteCreateDatabaseIfNotExists<>` as your `IDbInitializer<>`.
5863

5964
### Initializer Sample
65+
6066
```csharp
6167
public class MyDbContext : DbContext
6268
{
@@ -70,13 +76,15 @@ public class MyDbContext : DbContext
7076
}
7177
}
7278
```
79+
7380
Notice that the `SqliteDropCreateDatabaseWhenModelChanges<>` initializer will create a additional table in your database.
7481
This table is used to store some information to detect model changes. If you want to use a own entity/table you can implement the
75-
`IHistory` interface and pass the type of your entity as parameter in the to the constructor from the initializer.
82+
`IHistory` interface and pass the type of your entity as parameter in the to the constructor from the initializer.
7683

7784
In a more advanced scenario, you may want to populate some core- or test-data after the database was created.
7885
To do this, inherit from `SqliteDropCreateDatabaseAlways<>`, `SqliteCreateDatabaseIfNotExists<>` or `SqliteDropCreateDatabaseWhenModelChanges<>` and override the `Seed(MyDbContext context)` function.
7986
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.
87+
8088
```csharp
8189
public class MyDbContextInitializer : SqliteDropCreateDatabaseAlways<MyDbContext>
8290
{
@@ -91,6 +99,7 @@ public class MyDbContextInitializer : SqliteDropCreateDatabaseAlways<MyDbContext
9199
```
92100

93101
### SqliteDatabaseCreator Sample
102+
94103
```csharp
95104
public class MyContext : DbContext
96105
{
@@ -104,6 +113,7 @@ public class MyContext : DbContext
104113
```
105114

106115
### SqliteSqlGenerator Sample
116+
107117
```csharp
108118
public class MyContext : DbContext
109119
{
@@ -117,15 +127,18 @@ public class MyContext : DbContext
117127
```
118128

119129
## Structure
120-
I tried to write the code in a extensible way.
130+
131+
The code is written in an extensible way.
121132
The logic is divided into two main parts, Builder and Statement.
122133
The Builder knows how to translate the EdmModel into statements where a statement class creates the SQLite-DDL-Code.
123134
The structure of the statements is influenced by the [SQLite Language Specification](https://www.sqlite.org/lang.html).
124135
You will find an extensive usage of the composite pattern.
125136

126137
## Hints
138+
127139
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.
128-
In this case please check the following issue: https://github.com/msallin/SQLiteCodeFirst/issues/13.
140+
In this case please check the following issue: <https://github.com/msallin/SQLiteCodeFirst/issues/13.>
129141

130142
## Recognition
131-
I started with the [code](https://gist.github.com/flaub/1968486e1b3f2b9fddaf) from [flaub](https://github.com/flaub).
143+
144+
I started with the [code](https://gist.github.com/flaub/1968486e1b3f2b9fddaf) from [flaub](https://github.com/flaub).

0 commit comments

Comments
 (0)