Coder Social home page Coder Social logo

section-4-to-do-list-with-many-to-many-csharp-net6's Introduction

What Is This?

This is an example repo corresponding to multiple lessons within the LearnHowToProgram.com walkthrough on creating a To Do List application in Section 4: Many-to-Many Relationships.

This project corresponds to the classwork and lessons that describe how to connect an ASP.NET Core MVC project to a MySQL database using Entity Framework Core with migrations. This project contains a one-to-many relationship between Item and Doctor, and a many-to-many relationship between Item and Tag. There are multiple lessons in this series. The first lesson in the series is Code First Development and Migrations.

There are multiple branches in this repo that are described more below.

How To Run This Project

Install Tools

Install the tools that are introduced in this series of lessons on LearnHowToProgram.com.

Set Up and Run Project

  1. Clone this repo.
  2. Open the terminal and navigate to this project's production directory called "DoctorsOffice".
  3. Within the production directory "DoctorsOffice", create a new file called appsettings.json.
  4. Within appsettings.json, put in the following code, replacing the uid and pwd values with your own username and password for MySQL. For the LearnHowToProgram.com lessons, we always assume the uid is root and the pwd is epicodus.
{
  "ConnectionStrings": {
      "DefaultConnection": "Server=localhost;Port=3306;database=to_do_list_with_many_to_many;uid=root;pwd=epicodus;"
  }
}
  1. Create the database using the migrations in the To Do List project. Open your shell (e.g., Terminal or GitBash) to the production directory "DoctorsOffice", and run dotnet ef database update.
    • To optionally create a migration, run the command dotnet ef migrations add MigrationName where MigrationName is your custom name for the migration in UpperCamelCase. To learn more about migrations, visit the LHTP lesson Code First Development and Migrations.
  2. Within the production directory "DoctorsOffice", run dotnet watch run in the command line to start the project in development mode with a watcher.
  3. Open the browser to https://localhost:5001. If you cannot access localhost:5001 it is likely because you have not configured a .NET developer security certificate for HTTPS. To learn about this, review this lesson: Redirecting to HTTPS and Issuing a Security Certificate.

Available Branches

1_starter_project: This is the default branch with the starter code for the To Do List project as an ASP.NET Core MVC web application that is configured to use Entity Framework Core to communicate with a MySQL database as completed at the end of section 3. This branch is not meant to be run using the above instructions, as it is not configured to use EF Core migrations; instead it is meant to be used as a starting point for the refactor we begin in the LHTP lesson Code First Development and Migrations.

2_many_to_many_setup: This branch includes the code we added after working through the following lessons:

3_m2m_read_and_create: This branch includes the code we added after working through the following lessons:

4_m2m_update_and_delete: This branch includes the code we added after working through the following lessons:

5_model_validation: This branch includes the code we added after working through the following lesson:

6_data_from_multiple_db_tables: This branch includes the code we added after working through the following lesson:

section-4-to-do-list-with-many-to-many-csharp-net6's People

Contributors

remy-says-hi avatar eggborne avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.