Pre-built database for Xamarin and UWP

Hello,

I followed your guides and created a pre-built database by pulling it initially in the application. Then, I copied it to the Assets folder in UWP and I am trying to use that database to make the initial sync process quicker. However, in your guides you use this code block for UWP;

var assetsFolder = await Package.Current.InstalledLocation.GetFolderAsync(“Assets\seeddb.cblite2”);
var finalPath = Path.Combine(directoryPath, databaseName + “.cblite2”);
Directory.CreateDirectory(finalPath);
var destFolder = await StorageFolder.GetFolderFromPathAsync(finalPath);
var filesList = await assetsFolder.GetFilesAsync();

            foreach (var file in filesList)
            {
                await file.CopyAsync(destFolder);
            }

But you also state that unless we use any other method than Database.Copy, it will create checkpoint issues and I believe that is what I’m experiencing. As soon as a change occurs in remote, my pre-built database’s checkpoints are invalidated and it pulls the whole database all over again instead of just the changed documents.

After seeing that I also tried with Database.Copy() method but the same situation occured.

Is there anything wrong in my approach?

Did you follow the “Important notes” in this guide? if so, how was your database created and what replicator parameters did you use for creating the prebuilt database, It is critical that the SGW URL and filters used by the app for replication matches what is used during creation. Yes- copyDatabase() must be used for copying over the prebuilt database.

What version of CBL are you using ? We fixed some issues related to this that should be in latest 2.8.x version.

BTW, where is that code snippet from?

Tagging @ibsoln for any documentation impact

Yes, those are the guides that I followed. What I essentially did is start the application once, sync the database, get it from the default folder path, put it under the assets folder.

Then I simply delete the application and use the pre-built database with the same configs. If there are no changes it works fine, but then if I modify a couple of documents from the couchbase admin, it doesn’t work anymore, it simply pulls the entire database.

That code snippet is from the travel-sample and it more or less follows the same flow with the android project. I guess in those project there wasn’t much concern that documents will be modified.

I use the 2.6 version though because that’s also the version we use in the server. Would it work if I update only on the application side?