'Entity Framework Core SQLite How to use relative Data Source

In a current Project of mine I am using Entity Framework Core together with SQLite in an ASP.Net-Project.

My Problem is, that the Database in the project-files is used, instead of the one in the ./bin-Directory

I followed the instructions of the docs.microsoft-page to create the database:

https://docs.microsoft.com/de-de/ef/core/get-started/overview/first-app?tabs=visual-studio

This is the Connectionstring I am using.

protected override void OnConfiguring(DbContextOptionsBuilder options)
    => options.UseSqlite("Data Source=MySqliteDatabase.db");

I let the created Database be copyied over, when newer.

I browsed through a number of pages, looking for ways to provide a relative Database path, but I couldnt find a solution to this. It either still uses the project-DB-File, or it wont create the new Database, because it cant be opened, or so.

Does anyone have a solution to this? I noticed that Entity-Framework-Core-5 is kind of a new release, could this be a bug or similar of this particular version?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source