Dev Ops with ASP NET Core EF Core

  • Slides: 44
Download presentation
Dev. Ops with ASP. NET Core, EF Core, & TFS 2017 Benjamin Day @benday

Dev. Ops with ASP. NET Core, EF Core, & TFS 2017 Benjamin Day @benday | www. benday. com Learn. Imagine. Build. . NET Conf

The recording of this session is available at https: //channel 9. msdn. com/Events/dotnet. Conf/2017/T

The recording of this session is available at https: //channel 9. msdn. com/Events/dotnet. Conf/2017/T 219

Benjamin Day Brookline, MA Consultant & Trainer Scrum, Dev. Ops, Team Foundation Server, Software

Benjamin Day Brookline, MA Consultant & Trainer Scrum, Dev. Ops, Team Foundation Server, Software Architecture & Testing Microsoft MVP Pluralsight Author Scrum. org Trainer @benday | www. benday. com

New course coming soon! Dev. Ops Skills for Developers with Visual Studio & TFS

New course coming soon! Dev. Ops Skills for Developers with Visual Studio & TFS 2017

On with the show.

On with the show.

Busy?

Busy?

Too busy? : Productivity vs. Waste Task A Task B Task C Task D

Too busy? : Productivity vs. Waste Task A Task B Task C Task D Task E Waste 20% 40% 60% 75% 40% 100% 20% 10% 40% 10% 20% 1 Task @benday | www. benday. com 2 Tasks 3 Tasks 4 Tasks 5% 5% 5% 5 Tasks "Quality Software Management: Vol. 1 System Thinking“, Gerald Weinberg (1992)

Humans are terrible at multitasking.

Humans are terrible at multitasking.

To be productive, eliminate distractions.

To be productive, eliminate distractions.

Software delivery not software development.

Software delivery not software development.

Anything that slows you down, automate it.

Anything that slows you down, automate it.

Anything that’s painful, automate it.

Anything that’s painful, automate it.

What is Dev. Ops?

What is Dev. Ops?

Dev. Ops is a mindset plus a set of practices that focuses on automation.

Dev. Ops is a mindset plus a set of practices that focuses on automation.

Why Dev. Ops? Minimize distractions. Make delivery & deployment easy.

Why Dev. Ops? Minimize distractions. Make delivery & deployment easy.

Hint: You want more frequent releases.

Hint: You want more frequent releases.

If delivery & deployment is easy… …it’s not a big deal to do a

If delivery & deployment is easy… …it’s not a big deal to do a release - (Hopefully, without much human involvement) …you’ll do releases more often …you can focus more time writing & delivering features @benday | www. benday. com

Smaller, more frequent releases smaller batch size

Smaller, more frequent releases smaller batch size

Semi-Annual Releases Large Batch Size @benday | www. benday. com Daily / Weekly Releases

Semi-Annual Releases Large Batch Size @benday | www. benday. com Daily / Weekly Releases Small Batch Size

Smaller, more frequent releases are easier to manage & less to worry about.

Smaller, more frequent releases are easier to manage & less to worry about.

(Smaller mistakes. )

(Smaller mistakes. )

Dev. Ops for ASP. NET Core & EF Core. NET Conf

Dev. Ops for ASP. NET Core & EF Core. NET Conf

Dev. Ops Goals Version Controlled, Automated, Repeatable - Ideally, including hosting environment configuration -

Dev. Ops Goals Version Controlled, Automated, Repeatable - Ideally, including hosting environment configuration - (Docker, ARM templates, etc) Never deploy from a developer workstation - No right-click deploy Deploy from TFS Build Deploy from TFS Release Management Pipeline @benday | www. benday. com

ASP. NET Core & EF Core Dev. Ops Checklist Code is under version control

ASP. NET Core & EF Core Dev. Ops Checklist Code is under version control Database schema & changes are under version control Automated tests (unit tests, integration tests, UI tests) Automated build Automated release / deployment @benday | www. benday. com

Dev. Ops: Don’t Forget the Database! Does your app use a database? - You’ll

Dev. Ops: Don’t Forget the Database! Does your app use a database? - You’ll need to version control it Automated build & deploy of database schemas Two approaches: - SQL Server Data Tools (SSDT) - Entity Framework Migrations @benday | www. benday. com

Dev. Ops Tip: Learn how to do everything from the command line

Dev. Ops Tip: Learn how to do everything from the command line

. NET Conf

. NET Conf

EF Core & EF Core Migrations Summary

EF Core & EF Core Migrations Summary

EF Core Nu. Get Packages Talk to SQL Server Microsoft. Entity. Framework. Core. Sql.

EF Core Nu. Get Packages Talk to SQL Server Microsoft. Entity. Framework. Core. Sql. Server Database Updates (“Migrations”) Microsoft. Entity. Framework. Core. Design Reverse Engineer a SQL Server Database Microsoft. Entity. Framework. Core. Sql. Server. Design @benday | www. benday. com

Enable the “dotnet ef” Command Edit *. csproj Add Dot. Net. Cli. Tool. Reference

Enable the “dotnet ef” Command Edit *. csproj Add Dot. Net. Cli. Tool. Reference to Microsoft. Entity. Framework. Core. Tools. Dot. Net @benday | www. benday. com

EF Migrations = Entity Framework Version Control

EF Migrations = Entity Framework Version Control

Migrations from the Command Line Add / Remove a Migration dotnet ef migrations add

Migrations from the Command Line Add / Remove a Migration dotnet ef migrations add “{name}” dotnet ef migrations remove Deploy an Update dotnet ef database update @benday | www. benday. com

Things you need for EF Core Entity Framework DB Context - Starting point for

Things you need for EF Core Entity Framework DB Context - Starting point for all your database operations - Microsoft. Entity. Framework. Core. Db. Context IDesign. Time. Db. Context. Factory<T> - Handles creating instances of Db. Context for doing migrations - Microsoft. Entity. Framework. Core. Design. IDesign. Time. Db. Context. Factory @benday | www. benday. com

Hosting ASP. NET Core on IIS

Hosting ASP. NET Core on IIS

Host ASP. NET Core on IIS Install. NET Core Windows Server Hosting Bundle -

Host ASP. NET Core on IIS Install. NET Core Windows Server Hosting Bundle - ASP. NET Core 1. * https: //go. microsoft. com/fwlink/? linkid=848766 - ASP. NET Core 2. * https: //aka. ms/dotnetcore. 2. 0. 0 -windowshosting @benday | www. benday. com

TFS Build & Release

TFS Build & Release

. NET Conf

. NET Conf

Monumental Gotcha: “dotnet ef database update” assumes that you have the source code…

Monumental Gotcha: “dotnet ef database update” assumes that you have the source code…

(…and you won’t have your source code when you do a release. )

(…and you won’t have your source code when you do a release. )

. NET Conf

. NET Conf

ASP. NET Core & EF Core Dev. Ops Checklist Code is under version control

ASP. NET Core & EF Core Dev. Ops Checklist Code is under version control Database schema & changes are under version control Automated tests (unit tests, integration tests, UI tests) Automated build Automated release / deployment @benday | www. benday. com

Any last questions?

Any last questions?

Thank you. www. benday. com | benday@benday. com

Thank you. www. benday. com | benday@benday. com

. NET

. NET