Skip to content

How to set the database path using Entity Framework Core? #10093

Answered by ghost1372
haijialiu asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to use db next to exe you can use this code: (modify path for assets\DataBase)

var dbFile = @$"{AppContext.BaseDirectory}\Assets\DataBase\Al-Anvar.db";
        optionsBuilder.UseSqlite($"Data Source={dbFile}");
    

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@haijialiu
Comment options

Answer selected by haijialiu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants