Skip to content

snarkitect/dotnetcore-todo-app

Repository files navigation

  1. Web API

    • mkdir TodoApi
    • cd TodoApi
    • dotnet new webapi
  2. Use SQLite instead of InMemory

    • Startup.cs
    public void ConfigureServices(IServiceCollection services)
    {   
        services.AddDbContext<TodoContext>(options => options.UseSqlite("Data Source=TodoList.db"));
        services.AddMvc();
    }
    
    • Run dotnet ef migrations add InitialCreate to scaffold a migration and create the initial set of tables for the model.
    • Run dotnet ef database update to apply the new migration to the database. This command creates the database before applying migrations.
      • If you don't do this, you'll get errors like "SQLite Error 1: 'no such table"
  3. Go back to tutorial in step 1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages