Introduction to NET Florin Olariu Alexandru Ioan Cuza

  • Slides: 78
Download presentation
Introduction to. NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer

Introduction to. NET Florin Olariu “Alexandru Ioan Cuza”, University of Iași Department of Computer Science

Entity Framework Core – part 2

Entity Framework Core – part 2

Agenda Entity Framework Core – Short recap Entity Framework Core – Features Entity Framework

Agenda Entity Framework Core – Short recap Entity Framework Core – Features Entity Framework Core – Database providers support Entity Framework Core - Building connection strings Entity Framework Core - Managing migrations Entity Framework Core - Managing navigation properties Entity Framework Core - Using loading patterns in EF Core Entity Framework Core – Demo

Entity Framework Core - Short recap (1/4)

Entity Framework Core - Short recap (1/4)

Entity Framework Core - Short recap (2/4) Is a lightweight and extensible version of

Entity Framework Core - Short recap (2/4) Is a lightweight and extensible version of Entity Framework

Entity Framework Core - Short recap (3/4) Is a lightweight and extensible version of

Entity Framework Core - Short recap (3/4) Is a lightweight and extensible version of Entity Framework It is based on ORM (Object Relational Mapper) which give us the possibility to work with databases using. NET objects

Entity Framework Core - Short recap (4/4)

Entity Framework Core - Short recap (4/4)

Entity Framework Core – Features (1/11)

Entity Framework Core – Features (1/11)

Entity Framework Core – Features (2/11) Modeling

Entity Framework Core – Features (2/11) Modeling

Entity Framework Core – Features (3/11) Modeling Fluent API

Entity Framework Core – Features (3/11) Modeling Fluent API

Entity Framework Core – Features (4/11) Modeling Fluent API Data annotations

Entity Framework Core – Features (4/11) Modeling Fluent API Data annotations

Entity Framework Core – Features (5/11) Modeling Fluent API Data annotations Shadow properties

Entity Framework Core – Features (5/11) Modeling Fluent API Data annotations Shadow properties

Entity Framework Core – Features (6/11) Modeling Fluent API Data annotations Shadow properties

Entity Framework Core – Features (6/11) Modeling Fluent API Data annotations Shadow properties

Entity Framework Core – Features (7/11) Modeling Fluent API Data annotations Shadow properties It

Entity Framework Core – Features (7/11) Modeling Fluent API Data annotations Shadow properties It maintains the relation between entities with help of navigation and foreign key properties

Entity Framework Core – Features (8/11) Modeling Fluent API Data annotations Shadow properties It

Entity Framework Core – Features (8/11) Modeling Fluent API Data annotations Shadow properties It maintains the relation between entities with help of navigation and foreign key properties Change Tracking

Entity Framework Core – Features (9/11) Modeling Fluent API Data annotations Shadow properties It

Entity Framework Core – Features (9/11) Modeling Fluent API Data annotations Shadow properties It maintains the relation between entities with help of navigation and foreign key properties Change Tracking Save. Changes

Entity Framework Core – Features (10/11) Modeling Fluent API Data annotations Shadow properties It

Entity Framework Core – Features (10/11) Modeling Fluent API Data annotations Shadow properties It maintains the relation between entities with help of navigation and foreign key properties Change Tracking Save. Changes Model validation

Entity Framework Core – Features (11/11) Modeling Fluent API Data annotations Shadow properties It

Entity Framework Core – Features (11/11) Modeling Fluent API Data annotations Shadow properties It maintains the relation between entities with help of navigation and foreign key properties Change Tracking Save. Changes Model validation Query

Entity Framework Core – Database providers support(1/7)

Entity Framework Core – Database providers support(1/7)

Entity Framework Core – Database providers support(2/7) This version of Entity Framework Core 1.

Entity Framework Core – Database providers support(2/7) This version of Entity Framework Core 1. 0 supports:

Entity Framework Core – Database providers support(3/7) This version of Entity Framework Core 1.

Entity Framework Core – Database providers support(3/7) This version of Entity Framework Core 1. 0 supports: SQL Server

Entity Framework Core – Database providers support(4/7) This version of Entity Framework Core 1.

Entity Framework Core – Database providers support(4/7) This version of Entity Framework Core 1. 0 supports: SQL Server SQL Lite

Entity Framework Core – Database providers support(5/7) This version of Entity Framework Core 1.

Entity Framework Core – Database providers support(5/7) This version of Entity Framework Core 1. 0 supports: SQL Server SQL Lite Postgres

Entity Framework Core – Database providers support(6/7) This version of Entity Framework Core 1.

Entity Framework Core – Database providers support(6/7) This version of Entity Framework Core 1. 0 supports: SQL Server SQL Lite Postgres SQL Compact

Entity Framework Core – Database providers support(7/7) This version of Entity Framework Core 1.

Entity Framework Core – Database providers support(7/7) This version of Entity Framework Core 1. 0 supports: SQL Server SQL Lite Postgres SQL Compact Oracle (is work in progress)

Entity Framework Core - Building connection strings(1/5)

Entity Framework Core - Building connection strings(1/5)

Entity Framework Core - Building connection strings(2/5)

Entity Framework Core - Building connection strings(2/5)

Entity Framework Core - Building connection strings(3/5)

Entity Framework Core - Building connection strings(3/5)

Entity Framework Core - Building connection strings(4/5) For Postgre SQL : Nuget Package: Npqsql.

Entity Framework Core - Building connection strings(4/5) For Postgre SQL : Nuget Package: Npqsql. Entity. Frame. Core. Postgre. SQL(code first) Nuget Package: Npqsql. Entity. Frame. Core. Postgre. SQL. Design(database first)

Entity Framework Core - Building connection strings(5/5) For SQL local DB Nuget Package: Microsoft.

Entity Framework Core - Building connection strings(5/5) For SQL local DB Nuget Package: Microsoft. Entity. Framework. Core. Sql. Server (code first) Nuget Package: Microsoft. Entity. Framework. Core. Sql. Server. Design (database first)

Entity Framework Core - Managing migrations (1/8)

Entity Framework Core - Managing migrations (1/8)

Entity Framework Core - Managing migrations (2/8) Enable-Migrations

Entity Framework Core - Managing migrations (2/8) Enable-Migrations

Entity Framework Core - Managing migrations (3/8) Enable-Migrations Generating & Running Migrations

Entity Framework Core - Managing migrations (3/8) Enable-Migrations Generating & Running Migrations

Entity Framework Core - Managing migrations (4/8) Enable-Migrations Generating & Running Migrations Add-Migration

Entity Framework Core - Managing migrations (4/8) Enable-Migrations Generating & Running Migrations Add-Migration

Entity Framework Core - Managing migrations (5/8) Enable-Migrations Generating & Running Migrations Add-Migration Update-Database

Entity Framework Core - Managing migrations (5/8) Enable-Migrations Generating & Running Migrations Add-Migration Update-Database

Entity Framework Core - Managing migrations (6/8) Enable-Migrations Generating & Running Migrations

Entity Framework Core - Managing migrations (6/8) Enable-Migrations Generating & Running Migrations

Entity Framework Core - Managing migrations (7/8) Enable-Migrations Generating & Running Migrations

Entity Framework Core - Managing migrations (7/8) Enable-Migrations Generating & Running Migrations

Entity Framework Core - Managing migrations (8/8) Enable-Migrations Generating & Running Migrations

Entity Framework Core - Managing migrations (8/8) Enable-Migrations Generating & Running Migrations

Entity Framework Core - Managing navigation properties(1/14)

Entity Framework Core - Managing navigation properties(1/14)

Entity Framework Core - Managing navigation properties(2/14) One to One => 1: 1

Entity Framework Core - Managing navigation properties(2/14) One to One => 1: 1

Entity Framework Core - Managing navigation properties(3/14) One to One => 1: 1 One

Entity Framework Core - Managing navigation properties(3/14) One to One => 1: 1 One to Many => 1: many

Entity Framework Core - Managing navigation properties(4/14) One to One => 1: 1 One

Entity Framework Core - Managing navigation properties(4/14) One to One => 1: 1 One to Many => 1: many Many to Many => many : many

Entity Framework Core - Managing navigation properties(5/14) One to One => 1: 1 One

Entity Framework Core - Managing navigation properties(5/14) One to One => 1: 1 One to Many => 1: many Many to Many => many : many

Entity Framework Core - Managing navigation properties(6/14) One to One relationship

Entity Framework Core - Managing navigation properties(6/14) One to One relationship

Entity Framework Core - Managing navigation properties(7/14) One to One relationship

Entity Framework Core - Managing navigation properties(7/14) One to One relationship

Entity Framework Core - Managing navigation properties(8/14) One to One relationship

Entity Framework Core - Managing navigation properties(8/14) One to One relationship

Entity Framework Core - Managing navigation properties(9/14) One-to-Many relationship

Entity Framework Core - Managing navigation properties(9/14) One-to-Many relationship

Entity Framework Core - Managing navigation properties(10/14) One-to-Many relationship

Entity Framework Core - Managing navigation properties(10/14) One-to-Many relationship

Entity Framework Core - Managing navigation properties(11/14) One-to-Many relationship

Entity Framework Core - Managing navigation properties(11/14) One-to-Many relationship

Entity Framework Core - Managing navigation properties(12/14) Many-to-Many relationship

Entity Framework Core - Managing navigation properties(12/14) Many-to-Many relationship

Entity Framework Core - Managing navigation properties(13/14) Many-to-Many relationship

Entity Framework Core - Managing navigation properties(13/14) Many-to-Many relationship

Entity Framework Core - Managing navigation properties(14/14) Many-to-Many relationship

Entity Framework Core - Managing navigation properties(14/14) Many-to-Many relationship

Entity Framework Core - Using loading patterns in EF Core(1/19)

Entity Framework Core - Using loading patterns in EF Core(1/19)

Entity Framework Core - Using loading patterns in EF Core(2/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(2/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(3/19) Lazy loading Eager loading

Entity Framework Core - Using loading patterns in EF Core(3/19) Lazy loading Eager loading

Entity Framework Core - Using loading patterns in EF Core(4/19) Lazy loading Eager loading

Entity Framework Core - Using loading patterns in EF Core(4/19) Lazy loading Eager loading Explicit loading

Entity Framework Core - Using loading patterns in EF Core(5/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(5/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(6/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(6/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(7/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(7/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(8/19) Lazy loading Let’s change

Entity Framework Core - Using loading patterns in EF Core(8/19) Lazy loading Let’s change the message from loop in order to show the products.

Entity Framework Core - Using loading patterns in EF Core(9/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(9/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(10/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(10/19) Lazy loading

Entity Framework Core - Using loading patterns in EF Core(11/19) Eager loading

Entity Framework Core - Using loading patterns in EF Core(11/19) Eager loading

Entity Framework Core - Using loading patterns in EF Core(12/19) Eager loading

Entity Framework Core - Using loading patterns in EF Core(12/19) Eager loading

Entity Framework Core - Using loading patterns in EF Core(13/19) Eager loading

Entity Framework Core - Using loading patterns in EF Core(13/19) Eager loading

Entity Framework Core - Using loading patterns in EF Core(14/19) Eager loading

Entity Framework Core - Using loading patterns in EF Core(14/19) Eager loading

Entity Framework Core - Using loading patterns in EF Core(15/19) Explicit loading

Entity Framework Core - Using loading patterns in EF Core(15/19) Explicit loading

Entity Framework Core - Using loading patterns in EF Core(16/19) Explicit loading

Entity Framework Core - Using loading patterns in EF Core(16/19) Explicit loading

Entity Framework Core - Using loading patterns in EF Core(17/19) Tips

Entity Framework Core - Using loading patterns in EF Core(17/19) Tips

Entity Framework Core - Using loading patterns in EF Core(18/19) Tips Carefully consider which

Entity Framework Core - Using loading patterns in EF Core(18/19) Tips Carefully consider which loading pattern is best for your code.

Entity Framework Core - Using loading patterns in EF Core(19/19) Tips Carefully consider which

Entity Framework Core - Using loading patterns in EF Core(19/19) Tips Carefully consider which loading pattern is best for your code. The default of lazy loading can literally make you into a lazy database developer!

Entity Framework Core – Demo(1/2)

Entity Framework Core – Demo(1/2)

Entity Framework Core – Demo(2/2) Targets: How the model should be created How the

Entity Framework Core – Demo(2/2) Targets: How the model should be created How the navigation properties should be managed Manipulating connection string Database result Manipulating data using EF loading patterns

One more thing…(1/2)

One more thing…(1/2)

One more thing…(2/2)

One more thing…(2/2)

Bibliography Price, Mark. C# 6 and. NET Core 1. 0: Modern Cross-Platform Development (Kindle).

Bibliography Price, Mark. C# 6 and. NET Core 1. 0: Modern Cross-Platform Development (Kindle). Packt Publishing. Kindle Edition. https: //msdn. microsoft. com/en-us/library/jj 591621(v=vs. 113). aspx http: //www. c-sharpcorner. com/article/introduction-to-entity-frameworkcore/ https: //docs. efproject. net/en/latest/platforms/full-dotnet/new-db. html

Questions Do you have any other questions?

Questions Do you have any other questions?

Thanks! See you next time!

Thanks! See you next time!