Skip to end of metadata
Go to start of metadata

This page discusses things that require attention to use SQLite for local data storage in Crosslight applications.

The common local storage available in most mobile platforms is SQLite. Typically, each platform uses different way to perform data operation to SQLite which increasing technical difficulties and complexity when developing mobile apps. Thanks to the comprehensive and intuitive API, now you can use Crosslight SQLite to manage your local data storage elegantly. To learn more about Crosslight SQLite, see Local Data Access.

On this page:

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:

iOS - SQLite PreserveAssembly
Android - SQLite PreserveAssembly
WinPhone - SQLite PreserveAssembly
WinRT - SQLite PreserveAssembly

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.


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.