Connect to a SQLite Database using C

This repository contains a sample code project that demonstrates how to use the Entity Framework Core library to connect to and query data from a SQLite database using C#.

The code in this repository connects to a SQLite database in the same folder named blogging.db and uses EF Core to read from its data. The code demonstrates how to map database entities to C# classes and use the C# classes in place of the database entities. The repository also shows the same functionality implemented in Dapper and ADO.NET, to demonstrate the amount of operations and tasks that is abstracted by EF Core.

This sample draws from this tutorial for Getting Started with EF Core with SQLite.

Prerequisites

Installation

  • Clone or download the repository to your local machine.

  • Use Visual Studio to debug and run the project.

The sample code samples depend on having an existing database to connect to and query. This database is called blogging.db and located in the same folder.

Run

Each code sample has the same functionality implemented in a different way. When run, the code will generate a console app that connects to a SQLite database and queries it for all the blog posts stored.

Contribution

If you wish to contribute, you can submit a pull request.

Overall, this code is intended to provide a basic understanding of how Entity Framework Core can be used to interact with a SQLite database in a C# application, and should not be used as-is in a production environment. Instead, this code should be used as the beginning passage to build your database application.

Please let me know if you need more help by creating an issue.