Add SQLite PreserveAssembly Configuration
On each platform, Crosslight has AppInitializer.cs which is useful to initialize platform-specific functions. During build process, the linker of Xamarin SDK will remove unused class references, including SQLite class reference. To prevent the Xamarin SDK from removing the references, you will need to add an additional configuration in InitializeServices method of AppInitializer class such as shown in the following. The configuration for each platform is as simple as:
By adding this configuration, Xamarin SDK will treat SQLite class reference as in-used, so the SQLite will now run well.
Ensuring Windows Phone SQLite Assemblies
Windows Phone application development can only be done in Windows using Visual Studio, so the following steps is only applicable for Windows Phone development using Visual Studio 2012 (or above).
Check Visual Studio Gallery to install the correct version of SQLite extension for Windows Phone.
- If you are developing Windows Phone 8.0, please check SQLite for Windows Phone extension in: https://visualstudiogallery.msdn.microsoft.com/cd120b42-30f4-446e-8287-45387a4f40b7
- If you are developing Windows Phone 8.1, please check SQLite for Windows Phone 8.1 extension in: https://visualstudiogallery.msdn.microsoft.com/5d97faf6-39e3-4048-a0bc-adde2af75d1b
By default, Visual Studio does not provide SQLite extension to utilize SQLite in Windows Phone. Follow the steps below to add SQLite to a Windows Phone application:
- Install SQLite for Windows Phone in Visual Studio 2012 (or above) extensions and updates. From Visual Studio, go to Tools --> Extensions and Updates.
- After installed, right-click on the Windows Phone project and choose Add Reference...In the Reference Manager select the Windows Phone SDK 8.0 section on the left, then tick SQLite for Windows Phone from the Extensions list.
The Windows Phone project will now have SQLite listed in the project References.
Adding Crosslight Sqlite Assembly
In addition to the Sqlite runtime, the final step to use Crosslight Sqlite feature is to add the Crosslight Sqlite assembly to your Windows Phone project.
To do this, simply use the NuGet extension for Mac or Visual Studio and install the Intersoft.Crosslight.Data.Sqlite package.
To learn more on how to use Crosslight NuGet Packages, see Introduction to Crosslight NuGet Packages.