1.) Download the Xamarin PCL Database Sample Code (Visual Studio 2015):
Download link.
2.) This sample code is a Xamarin project implementation of SQLite database using C# for using the the following library:
SQLite.Net-PCL by oystein krog, Frank Krueger, Tim Heuer
SQLite.NET-PCL is an open source, minimal library to allow .NET and Mono applications to store data in SQLite databases.
It is a fork of the original sqlite-net project, which aims to cleanup/improve the code and deliver the package as PCL assemblies with some additional platform-specific implementations.
3.) The source code was created using Visual Studio 2015.
If you do not have a Visual Studio 2015 or higher version, proceed to download Visual Studio 2017 community edition.
https://www.visualstudio.com/vs/express/
4.) This sample code was created using the following references:
6.) Project specifications:
6.1) Visual Studio project:
Available under NuGet Manager.
6.3) Android Project Settings:
Download link.
2.) This sample code is a Xamarin project implementation of SQLite database using C# for using the the following library:
SQLite.Net-PCL by oystein krog, Frank Krueger, Tim Heuer
SQLite.NET-PCL is an open source, minimal library to allow .NET and Mono applications to store data in SQLite databases.
It is a fork of the original sqlite-net project, which aims to cleanup/improve the code and deliver the package as PCL assemblies with some additional platform-specific implementations.
3.) The source code was created using Visual Studio 2015.
If you do not have a Visual Studio 2015 or higher version, proceed to download Visual Studio 2017 community edition.
https://www.visualstudio.com/vs/express/
4.) This sample code was created using the following references:
- https://developer.xamarin.com/guides/xamarin-forms/working-with/databases/
- https://developer.xamarin.com/samples/xamarin-forms/Todo/
- https://www.codeproject.com/Articles/1097179/SQLite-with-Xamarin-Forms-Step-by-Step-guide
6.) Project specifications:
6.1) Visual Studio project:
- Templates --> Visual C# --> Cross-Platform --> Cross Platform App (Xamarin)
- UI Technology --> Xamarin.Forms
- Code Sharing Strategy --> Portable Class Library (PCL)
Available under NuGet Manager.
6.3) Android Project Settings:
- Minimum android version : Android 4.0.3 (API Level 15 - Ice cream Sandwich)
- Target android version : Compile using SDK version
- Download the sample code.
- Unzip the file
- Open the Visual Studio Solution file : PCL_DB_Pub.sln.
Make sure you have Visual Studio 2015 or higher.
- Project references
- Take note that the references files (project library) was not included in the zip file due to its size.
However, Visual Studio should be able to automatically restore the references when the projects are first loaded - make sure the Internet connection is stable. - Optional
In case Visual Studio fail to automatically restore the refences, you will have to do it manually.
To restore the references for both portable and Android project, make use of NuGet Manager.
Copy and backup the content of the packages.config file into notepad for both Portable and Android project.
Save the notepad files.
Clear the content of packages.config file for both Portable and Android project - maintain the root element- save the changes.
Copy and backup the packages list of packages.config
Clear the packages list and save the file
Install each library reference using NuGet Manager, make sure you select the proper version - it will help you to install dependencies as well.
- Take note that the references files (project library) was not included in the zip file due to its size.
- Once you have restored all references - which include the reference for SQLite.Net-PCL - build the project.
- Simulate the app using an Android Emulator.
The sample app whilst running in an Android Emulator
Comments