![]() ![]() Any web service call works as before but now stores the data in the SQLite database - thanks to Entity Framework.īut before you start adding all the data manually in the DB Browser, let’s have a look at how to seed the database programmatically. When you add, edit or delete a record, make sure to click the “Write Changes” button in the top menu to make your changes persistent. To see the content of a table you can select the second tab “Browse Data” and select the table you want to see. You find the database structure with all the tables in the first tab. Please make yourself a bit familiar with the DB Browser. There is also a portable version available.Īfter the installation, please open the database file of our web application which can be found in the root directory of the project. ![]() So please download the DB Browser and install it. You see, we really are cross-platform here. You can download it on and it is available for Windows, macOS, and Linux. Probably the most used tool to create, design, and edit database files compatible with SQLite would be the DB Browser for SQLite. Now we need a tool to open the file and browse through the database. We create the database file with dotnet ef database update. Tables will be created, keys will be set, and so on. The generated files should look familiar. The easiest way to create the SQLite database with code-first migration is to delete the migrations folder and add a new initial migration.Īs soon as you have removed the folder with all migration files, add a migration again with dotnet ef migrations add Initial. Since the DataContext is now configured to use a SQLite database, the existing migration files won’t work. We’re ready to create the SQLite database. Let’s do that in the terminal with the command dotnet add package .Īfter the installation, you should see the change in your project file.Įnter fullscreen mode Exit fullscreen modeĪlright. The very first thing we have to do to be able to use a SQLite database is adding a new package, which would be. New Package, ConnectionString & Configuration This means, you don’t have to add users, characters, skills, and so on manually. We will configure the application for SQLite, start the migrations from scratch and use the DB Browser for SQLite to have a look at the database.Īdditionally, you will learn how to seed the database. ![]() So, it was time to add this chapter with example implementations for SQLite. In that case, SQLite is a popular choice. Many students want to use a database that is cross-platform, lightweight, and usable in many different scenarios such as smartphones, for instance. If you don’t want to use SQL Server for your web application, you might want to choose SQLite. SQLite & Data Seeding with Entity Framework Core You can watch the first hour on YouTube or get the complete course on Udemy. This tutorial series is now also available as an online video course. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |