2

I'm trying to set Sqlite ThreadMode to Serialized in my Xamarin.iOS project. Using classic Sqlite, one finds this method on the connection class:

SqliteConnection.SetConfig(SQLiteConfig.Serialized);

However I'm using sqlite-net (+async) and can't find a way to set this configuration property.

Any suggestions?

1 Answer 1

5

Ok, I had to update SQLite-Net (and SQLite-Net-PCL etc) to 2.5.

Then this option can be accessed through the platform specific implementation:

public Repository(IPlatform platform)
    {
        _platform = platform;
        _platform.SqlitePlatform.SQLiteApi.Config(ConfigOption.Serialized);

        _db = new SQLiteAsyncConnection(() =>
            new SQLite.Net.SQLiteConnectionWithLock(
            _platform.SqlitePlatform,
            new SQLite.Net.SQLiteConnectionString(_platform.DatabasePath, true)));
    }
Sign up to request clarification or add additional context in comments.

3 Comments

Does this constructor still exist? I can't find it in the github repository linked and neither can I find it in my code. What namespaces do I need? What is the IPlatform interface?
there is no such constructor

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.