LiteDB in UWP open a database in share mode

0

I wanted to know how I can open the LiteDB database with the shared mode application so I can see the changes with a PC?

var localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
            var folderPath = localFolder.Path;
            var filePath = Path.Combine(folderPath, DBName);
            ConnectionString ConnectionString_DB = new ConnectionString();
            ConnectionString_DB.Filename = filePath;
            ConnectionString_DB.Async = true;
            ConnectionString_DB.Mode = LiteDB.FileMode.Exclusive;

            //Global_DB = new LiteDatabase(filePath);
            Global_DB = new LiteDatabase(ConnectionString_DB);

            LineasReporteDB = Global_DB.GetCollection<LineaReporte>("LineasReporte");//prepara la coleccion para las lineas

This example is done in UWP and what I want to do is to be able to open the database file with the program on the PC in read only, but the file looks like this! on the LiteDB page it says that I can talk about it in Shared mode but this possibility is not available.

    
asked by Carlos Pichardo Viuque 23.03.2018 в 17:21
source

1 answer

0

Change this line

ConnectionString_DB.Mode = LiteDB.FileMode.Exclusive;

for this

ConnectionString_DB.Mode = LiteDB.FileMode.Shared;

That will make the database open in shared mode.

EDIT:

Try using SharedLocalFolder instead of LocalFolder and make sure you have the necessary permissions.

Everything stored in LocalFolder is for personal use of the application, I do not know what you would like to share it with.

    
answered by 27.03.2018 в 01:23