![]() ![]() Create the database connection as a singleton.ĭatabase = new NoteDatabase(Path.Combine(Environment.GetFolderPath(), "Notes.db3")) Then replace the existing code with the following code: using System In Solution Explorer, in the Notes project, expand App.xaml and double-click to open it. Save the changes to NoteDatabase.cs by pressing CTRL+S. This path will be provided by the App class in the next step. In addition, the NoteDatabase constructor takes the path of the database file as an argument. The code uses asynchronous SQLite.NET APIs that move database operations to background threads. This class contains code to create the database, read data from it, write data to it, and delete data from it. In NoteDatabase.cs, replace the existing code with the following code: using ĭatabase = new SQLiteAsyncConnection(dbPath) In Solution Explorer, in the Notes project, add a new class named NoteDatabase to the Data folder. In Solution Explorer, add a new folder named Data to the Notes project. The application will not currently build due to errors that will be fixed in subsequent steps. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |