In previous post, I showed you how to implement a custom migration without using Entity Framework for Sqlite database in .Net core. In this post, I’ll use Entity Framework Migration to manage (upgrade / downgrade) our database structure. Both of approaches will work, you can choose one of 2 solutions as you prefer.
In last months there were 2 big frameworks for software development published: DotNetCore and Angular 2. They’re new and powerful. I’ve spent most of my free time to learn both of them. The combination of DotNetCore Web Api and Angular 2 give me a powerful development enviroment for building website or building web-view app (based on Apache Cordova). I’ve started to build some web apps with Angular 2 (for example YouTubeApp or my private dictionary EnDeVi). They are all my pet projects but it’s a good start for learning new stuffs. In this blog, I would like to write about DotNetCore and Sqlite like the previous post Sqlite with Entity Framework Code First and Migration. Basically there’s nothing new with this post, I just want to test how I can write a simple .NET core console connecting to Sqlite database.
Last month I’ve a chance to develop an app using Sqlite and Entity Framework Code First. Before I started with this project, I thought everything will be easy because Sqlite and Entity Framework are both popular framework. Maybe I just need to install some nuget packages and it will work like a charm. But… yes, there is always a ‘but’ later, it’s just not so easy. Especially when I usually work with NHibernate than Entity Framework. The installation doesn’t complete his job when configuring the .config file (or maybe it just happens for me or does the author do it with intentionally?) and the Migration for Sqlite Entity Framework Code First is not supported (please correct me if I’m wrong). There are, of course, commercial products for Sqlite Migration but I prefer an open source framework or something free :). So in this post I would like to write down the steps required when starting a project for Sqlite Entity Framework Code First and how I make my own simple Migration engine.
If you follow my previous posts, you may already know that we discussed how to make an application with database in Android before in Android, Dependency Injection (IOC) with roboguice and MVVM (Model-View-ViewModel) pattern. Although the main topic in that article relates to Dependency Injection but we had also a working example which fully supports all CRUD actions for Sqlite database. However, in practice, it shouldn’t work like that because the synchronous read/write actions will block the user interface and your apps will freeze. When your database grows over time, the query time gets longer and you app will completely freeze during the query get executed. Therefore, in this post, I would like to make a sample for illustrating how a database application can work in asynchronous mode.