1

I'm new to noSQL and trying to use litedb.

I want to change the location of the db storage.

Right now this code:

using (var db = new LiteDatabase(@"MyData.db"))
{
}

Creates the database at projectName\bin\Debug

Is there a way to create the DB from the root of the project?

Is there a reason to leave the DB there? Maybe I'm wrong trying to do this.

Any help is appreciated!!!

Sergio
  • 57
  • 2
  • 10

1 Answers1

1

In connection-string you are using relative path, it will be created where the application is located, you can use the full path to specify the location. Eg: new LiteDatabase("C:\Folder\MyData.db")

And to change the location you simply need to use File.Move() on your existing database to move it to the desired location, then open the database with that new path.