2

I'm trying to make a connection to a SQLite database using Visual Studio 2015 the target platform is Android.

I've found this SO question but I can not get it to work. My problem is the part of installing packagde.

I want to have my database stuff placed in a Class Library so I've created a new Application, and added a Class Library to the solution.

To install SQLite I've written the following in the packagde manager console:

Install-Package SQLite.Net.Platform.XamarinAndroid -Version 2.3.0

But installs SQLLite into my application, not my Class Library.

My Class Library is very very simple:

    public class SQLiteDataService
    {
        private SQLiteAsyncConnection connectionFlexCheckDemo;
        private ISQLitePlatform sqlitePlatform;

        private string FlexCheckDBNameDemo = "FlexCheckDemo.db";

        private void Test()
        {
            var platform = new SQLitePlatformAndroid();            
        }    
    }    

but it doesn't compile:

Error CS0234 The type or namespace name 'Net' does not exist in the namespace 'SQLite' (are you missing an assembly reference?) ...

What am I doing wrong? And more important how to make it work.

4
  • You need to install SQLLite-PCL Async to your class library and the specific platform projects. Commented Oct 27, 2015 at 8:50
  • Thankyou @Rohit you need to bee a little more specific because I cant find SQLLite-PCL in Nuget Commented Oct 27, 2015 at 8:54
  • 1
    I have added an answer with the link to the specific nuget, so that you don't have trouble finding it. :) Commented Oct 27, 2015 at 9:00
  • I'll try it out and return shortly :D Commented Oct 27, 2015 at 9:01

1 Answer 1

1

You will have to install the Nuget or the dll to reference the SQLite-Async in your Shared or PCL project so that you can write your common code there like having common CRUD operations or having Unit Of Work coupled with Repository pattern. A simple example can be found here.

Then in your platform specific projects you need to have the nuget installed as well, which will get resolved and install the corresponding version based on your platform. I don't think there is a nuget available for WP, so you might have to look for other choices.

This is the nuget package for SQLite.Net.Async PCL

Sign up to request clarification or add additional context in comments.

2 Comments

Looks very promising :D
@JensBorrisholt - Happy to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.