When I run
Scaffold-DbContext "Filename=mydatabase.sqlite3" Microsoft.EntityFrameworkCore.Sqlite
I get an empty context
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
namespace MyNamespace
{
public partial class mydatabaseContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite(@"Filename=mydatabse.sqlite3");
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
}
}
}
Am I doing something wrong. Is this available for SQLite?
I have a single table in the database with id and name, just a simple example to get me going.
It is creating a new database in bin folder because of the relative path in the connection string. I used new connection string.
Scaffold-DbContext "DataSource=C:\dev\mydatabase.sqlite3" Microsoft.EntityFrameworkCore.Sqlite
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With