Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Core Entity Framework

This sample project contains features for Entity Framework Core Code First Migrations.

These are the key dependencies:

  • Microsoft.EntityFrameWorkCore
  • Microsoft.EntityFrameWorkCore.Tools
  • Microsoft.EntityFrameWorkCore.SqlServer

Running the Project

  1. View > Sql Server Object Explorer
  2. (localdb)\MSSQLLocalDB
  1. Create New Database
  2. Right Click Database > Properties > Connection String
  3. Use template in AppSettings.json, Program.cs
  4. Tools > NuGet Package Manager > Package Manager Console
  5. update-database
  6. Enter records for products
  7. localhost:xx/swagger/index.html
  8. Try It Out on GET api/product

Index of Examples

  1. Core Entity Framework
  2. Core API
  3. Core Services
  4. MVC & ViewModels
  5. Simple Authentication
  6. Image/File Upload
  7. Role Based Authorization
  8. Conditional Access
  9. Conditional Rendering
  10. Client Integration
  11. Workers and Server to Server Communication

Test your understanding!

  • Modify Product.cs to include ProductPrice (decimal)
  • Tools > NuGet Package Manager > Package Manager Console > add-migration productprice
  • Update the database with the new product price migration, creating the price column on the product table
  • Add a new entity /Models/Review.cs
  • Register 'Reviews' in AppDbContext.cs
  • Add a migration 'review'
  • Update the database with the review migration, creating a reviews table
  • Link Customers and Reviews (One customer may write many reviews, each review for one customer)
  • Add-Migration 'customer-reviews'
  • Update the database with the customer reviews migration, creating a customer ID FK on the review table
  • Create a migration which links the review to the product as well (one product has many reviews, each review for one product)
  • Modify Review.cs to have 'Stars' as an integer
  • add-migration 'stars'
  • update database customer reviews to go back to customer reviews migration
  • remove-migration
  • update database
  • change Review.cs Stars to a float
  • add-migration
  • update-database

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages