Working with SQLite on .NET–5

 Published On

Here is the final article of SQLite series.

SQLite Limits

I don’t expect you to read entirely but at least take a look at these notes It is important to know limitations of the tool you are using. This may also affect your choice regarding the tool you’ll use in your project.

Optimizing performances

Thomas Bandt made a nice blog post and kindly gives some tips based on his experience. Also, please take a look at the official web site which contains valuable information.

Making SQLite calls async

There is a GitHub repo which’ll let you to do async data access. It is -for the moment- the best one I found.

What if I want to use it on mobile apps?

This fellow created a series of two articles which explain very clearly how to use SQLite on universal applications. Also, this article -despite the fact that it is a bit old- gives good idea of where to start.

What if I want to parse an existing CSV to fill my database?

That happened to me when I was working on a project that employs SQL Server :). What I did was to create a data importer class using a library called fast member The basic idea is:

  • parse the CSV
  • transform lines into objects
  • gather these objects using a list
  • bulk insert them into the database (fast-member takes a list and creates a reader that you can use in in WriteToServer method. Here is a code snippet:
private void BulkInsert(List<YourModelClass> list)
    using (var connection = new SqlConnection(_configuration.SqlServerConnectionString))
        _output.WriteLine("connection opened with success!");
            using (var bcp = new SqlBulkCopy(connection))
                using (var reader = ObjectReader.Create(list, 
                    bcp.DestinationTableName = "TableNameInDatabase";
        catch (SqlException exception)
            _output.WriteLine(string.Format("some shxx happened {0} {1} {2}", 
        catch (Exception exception)
            _output.WriteLine(string.Format("some shxx happened {0}", exception.Message));

Are there any other tools that can facilitate my life?

Along with fast-member, there are 2 libraries that I use frequently :

Tags:   .net   c#   github   programming   sqllite


comments powered by Disqus

© 2017 - Mechanical Object. All rights reserved
Built using Jekyll