Download - Entity Framework Core with ASP.NET Core Overview

Transcript
Page 1: Entity Framework Core with ASP.NET Core Overview

ASP.NET Core*Shahed ChowdhuriSr. Technical Evangelist @ [email protected]

A Quick Overview of ASP.NET Core

* aka ASP.NET 5 before RC1

Page 2: Entity Framework Core with ASP.NET Core Overview

ASP.NETWeb API

Active Server Pages

(Classic ASP)

ASP.NET(Web

Forms)

ASP.NETMVC

1/2/3/4/5

ASP.NETWeb

Pages

ASP.NETMVC 6

Unified MVC,

Web API and Web

PagesASP.NETWeb API

Active Server Pages

(Classic ASP)

ASP.NET(Web

Forms)

ASP.NETMVC

1/2/3/4/5

ASP.NETWeb

Pages

ASP.NETMVC 6Core MVC

Unified MVC,

Web API and Web

Pages

Evolution of ASP and ASP .NET

Page 3: Entity Framework Core with ASP.NET Core Overview

C# 6.0

.NET Framework

4.6

ASP.NET 5(runs on .NET Core 5

or .NET Framework 4.5.2+)

ASP.NET MVC 6

.NET Core 5 SignalR 3

C# 6.0

.NET Framework

4.6

ASP.NET 5 Core 1.0(runs on .NET Core 5 1.0

or .NET Framework 4.5.2+)

ASP.NET MVC 6Core MVC

.NET Core 5.NET Core

1.0

SignalR 3

Names & Version Numbers

Page 4: Entity Framework Core with ASP.NET Core Overview

ASP.NET Core High-Level Overview

Page 5: Entity Framework Core with ASP.NET Core Overview

Compilation Process

Page 6: Entity Framework Core with ASP.NET Core Overview

What About .NET Framework 4.6?

Page 7: Entity Framework Core with ASP.NET Core Overview

How about Entity Framework?

DB

ORM

Entities in

Code

Page 8: Entity Framework Core with ASP.NET Core Overview

Entity Framework Core*

Shahed ChowdhuriSr. Technical Evangelist @ [email protected]

The Future of EF for ASP.NET Core

* aka EF7 before RC1

Page 9: Entity Framework Core with ASP.NET Core Overview

EF Core Agenda Overview Models and Fields Connection Strings Add Initial Migration Additional Migrations Controllers and Views Migration History and Snapshots

Page 10: Entity Framework Core with ASP.NET Core Overview

DB-Driven Web Applications

Database

Web App Internet

Users

ORM

Page 11: Entity Framework Core with ASP.NET Core Overview

Models and Fields

C# classes with data types, annotated with attributes

Page 12: Entity Framework Core with ASP.NET Core Overview

Connection Strings

Added with DB Context Options in Startup.ConfigureServices()

Page 13: Entity Framework Core with ASP.NET Core Overview

Connection Strings in Development

More info: http://docs.asp.net/en/latest/security/app-secrets.html

Page 14: Entity Framework Core with ASP.NET Core Overview

Connection Strings in Azure

More info: https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure

Page 15: Entity Framework Core with ASP.NET Core Overview

Add Initial Migration *>dnvm use 1.0.0-rc1-update1

>dnx ef migrations add initial

>dnx ef database update* Subject to change after RC2, see official documentation: https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html

Page 16: Entity Framework Core with ASP.NET Core Overview

Add Additional Migrations *>dnvm use 1.0.0-rc1-update1

>dnx ef migrations add FriendCode

>dnx ef database update

* Subject to change after RC2, see official documentation: https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html

Page 17: Entity Framework Core with ASP.NET Core Overview

EF Migration Commands

More info: https://msdn.microsoft.com/en-us/magazine/mt614250.aspx

Page 18: Entity Framework Core with ASP.NET Core Overview

Controllers and Views

Page 19: Entity Framework Core with ASP.NET Core Overview

Migration History and Snapshots