A Tour of EF Core’s Most Interesting & Important Features

Slides:



Advertisements
Similar presentations
Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify.
Advertisements

Intro to Entity Framework By Shahed Chowdhuri Don’t drown in database design during WakeUpAndCode.com.
Entity Framework 7 Who Are You & What Have You Done to my ORM?
Entity Framework 7: What’s New? Ricardo Peres Technical Evangelist at Simplifydigital. Microsoft
Entity Framework Database Connection with ASP Notes from started/getting-started-with-ef-using-mvc/creating-an-
What is it all about? .NET MeetUp in Prague, CZ (2017/7/19)
Top 10 Entity Framework Features Every Developer Should Know
DevOps with ASP.NET Core and Entity Framework Core
12/29/2017 2:33 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Modernizing your. NET applications with. NET Standard,
Build and Learn ASP.NET Workshop.
Introduction to Entity framework
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Unleash .NET 2015 in your apps
Introduction to .NET Florin Olariu
Introduction to Entity Framework
Getting started with .NET Core
5/15/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
5/15/2018 5:43 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
What’s new in Entity Framework Core 2.0
DotnetConf 9/10/2018 7:49 PM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE.
Data centric apps for web, desktop and mobile with EF5
ASP.NET Core: Web apps, cloud apps, and containers
6/2/2018 4:08 AM BRK3327 Ten things you didn't know about building .NET UWP apps in Visual Studio 2017 Daniel Jacobson Program Manager – Visual Studio.
The Modern ASP.NET Tech Stack!
 .NET CORE
Did your feature got in, out or planned?
Building Innovative Apps using the Microsoft Developer Platform
SQL Server Data Tools for Visual Studio Part I: Core SQL Server Tools
Entity Framework By: Casey Griffin.
Entity Framework Core for Enterprise Applications
DNN Connect 2017 Microsoft Keynote
Introducing ASP.NET Core 2.0
Microsoft Virtual Academy
Microsoft Connect /17/ :55 PM
Microsoft 365 Business Customer Targeting 2/6/18
1.1. .NET architectural components and .NET Core
Learn. Imagine. Build. .NET Conf
.NET Standard Jon Galloway | Executive Director, .NET |
What is it all about? .NET MeetUp in Amsterdam, NL (2017/7/11)
ADO.NEXT Advances in Data Access for 2008
Microsoft Ignite NZ October 2016 SKYCITY, Auckland
Slides and images stolen from “real” .NET Conf. presenters
DotnetConf 11/14/2018 3:27 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE.
Overview of the .NET Platform
Microsoft Ignite /14/ :21 AM BRK2101
Microsoft Build /14/ :29 PM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
Microsoft Build /15/2018 6:28 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
An Introduction to Entity Framework
11/19/2018 4:38 AM Microsoft 365 Business Customer Targeting Janine Brittain - EXEED 2/6/18 © Microsoft Corporation. All rights reserved. MICROSOFT.
.NET and .NET Core Foot View of .NET Pan Wuming 2017.
Entity Framework Core.
Microsoft Build /30/2018 2:15 AM Migrating Silverlight Windows Phone apps to the Universal Windows Platform Ricardo Villalobos Principal SDE Manager.
Microsoft Connect /1/2018 2:36 AM
12/3/2018 7:56 PM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Entity Framework Core (EF Core)
Tech Ed North America /1/ :36 AM Required Slide
What’s new in ASP.NET Core and Entity Framework 2.2 (Preview 3)
Microsoft Connect /22/2019 9:54 PM
From Development to Production: Optimizing for Continuous Delivery
.NET Conf 2018 Keynote Jose Barbosa Aaron Amm Theeranit.
Entity Framework Core for Enterprise Applications
From Development to Production: Optimizing for Continuous Delivery
Implementing Entity Framework with MVC Jump Start
Data Access in .NET Core 3.0 Applications
Mark Quirk Head of Technology Developer & Platform Group
Visual Studio 2010 and .NET Framework 4 Training Workshop
The Future is Now with ASP.NET Core 3.0
#01# ASP.NET Core Overview Design by: TEDU Trainer: Bach Ngoc Toan
Blazor A new framework for browser-based .NET apps Ryan Nowak
Presentation transcript:

A Tour of EF Core’s Most Interesting & Important Features Julie Lerman @julielerman about.me/julielerman

“Entity Framework (EF) Core is a lightweight and extensible version of the popular Entity Framework data access technology.” EF Core Documentation

EF 6.x EF Core

github.com/aspnet/entityframework docs.efproject.net

Modern Software Practices .NET Core Themes Composable APIs Cross-Platform Modern Software Practices

Highlights of EF Core Began life as “EF7” 1.0 RTM June 27, 2016 Lightweight, Composable version of EF Performance, generated SQL, runtime model building & etc More flexible logging (ILoggerProvider) Integrates with ASP.NET Core Windows, X-Plat with .NET Core, UWP, Xamarin Lots of new features

Coming from EF6? Not replacing, nor an update to, EF6.x Total re-write, not backwards compatible Drops EDMX, ObjectContext Many familiar APIs: DbContext, Change Tracker, Migrations, LINQ

have to re-learn everything You do not have to re-learn everything

But… it’s still new & different

COMMON INFRASTRUCTURE 9/9/2018 1:37 AM Unified platform .NET FRAMEWORK WINDOWS APPLICATIONS .NET CORE CROSS-PLATFORM SERVICES MOBILE APPLICATIONS XAMARIN TOOLS Visual Studio Visual Studio Code .NET STANDARD LIBRARY COMMON INFRASTRUCTURE Xamarin Studio Compilers Languages Runtime components EF6.x EF Core © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Where Can You Use EF Core? .NET 4.5.1+ .NET Core UWP Windows Windows, macOS, Linux Windows 10 OS Any .NET 4.5.1+ Console WinForms WPF ASP.NET 4 etc.. ASP.NET Core Web Apps & APIs Libraries Services Console Apps Mobile PC HoloLens Xbox Surface Hub IoT Devices App Types EF Core runs in .NET core and .NET core runs in a LOT of places! Inside of the full .NET Framework (that is any version from 4.5.1 and newer, or on the more limited .NET Core which is the runtime that can run natively not only on windows but also on Mac and linux and also on another limited version of .NET which is the Universal Windows Platform for Windows 10. That doesn’t necessarily mean that you *should* use EF core in all of these scenarios. And this is a really important point

EF6 Features vs EF Core Features New EF Core 1.0.0 EF Core >1.1.0 EF6 Feature Set EF Core 1.1.0 Limited Parity EF Core 1.0.0 Never coming to EF Core

bit.ly/efcoreroadmap Implemented (1.0) In Progress (1.1) Backlog  ”EF6.x continues to be the best version of EF for a number of applications until these features are implemented” Implemented (1.0) In Progress (1.1) Backlog Critical O/RM The things we think we need before we say EF Core is the recommended version of EF. High priority features Many features on our backlog High priority but we think EF Core would be a compelling release for the vast majority of applications without them

EF Core 1.1 (Preview is Here! RTM Late Q4 2016) Bug fixing to improve stability Critical O/RM features Removing adoption blockers Improved LINQ translation DbSet.Find Explicit Loading More EntityEntry APIs: Reload, GetModifiedProperties, GetDatabaseValues etc. Connection resiliency Parity with EF6.x Mapping to fields for scalar properties* SQL Server memory-optimized table support Simplified service replacement New Capabilities

EF Core Enables Long-Requested Features Batch Insert, Update, Delete Unique Constraints Smarter Queries Smarter Disconnected Patterns In-Memory Provider for Testing Extensible & IoC Friendly Model-Only Properties (“Shadow State”) Smarter & Simpler Mapping But these changes will enable EF to solve problems that we’ve been asking of EF for a long time. The existing code base hindered the EF team from achieving many of these features but some are already in the 1.0 version of EF Core and more have been added to upcoming releases and even more are planned for future releases of EF Core. Some examples of features that we’ve already gained with EF Core are the ability to [CLICK] do batch insert, updates and deletes – something that has never been supported in EF although some community members have created extensions to give us that behavior in the meantime. [CLICK]We’ll can specify unique foreign keys in entities …another feature that we’ve been asking for since the first version. [CLICK]LINQ queries have become smarter ..one way EF Core enables this is to allow providers to pick and choose which parts of a query will get convereted to TSQL and which will be executed in memory. This allows us to use inline functions in our queries and also to compose LINQ methods on top of raw sql and the composed query be fully executed on the server. [CLICK] Disconnecte entities and graphs have always been troublesome. The team has created patterns to make it easier to work with entities and graphs in disconnected apps as well as to provide consistent behavior. [CLICK]Thanks to the new flexibility for providers, the team was able to create an in-memory provider that makes it really easy to build automated tests against EF code that don’t need to hit the database. This remains one of my favorite features! [CLICK]We’ve also asked Microsoft to make Entity framework more extensible and EF Core is designed to be easy to use Inversion of Control patterns and dependency injection and it integrates with ASPNET Core’s service provider functionality. [CLICK]. A source of frustration for many developers was that we could not completely hide a property in domain classes because EF could not materialize fields, only properties. EF Core is now able to populate backing fields. This is another new feature that I’m particularly fond of! [CLICK] Among improvements to EF’s mapping are capabilities such as smarter and simpler ways to create one to one and to express relationships. If you go to data.uservoice.com, focusing on the entityframework requests you can see that many of the points I just highlighted have been on the list for a long time. You can also see notes that work has been started or is being planned to attack these long requested features. In later modules of this course, I’ll show you examples of these features in action. EF Core 1.1 Mapping to Backing Fields Opt out of DB Transactions at SaveChanges Temporary Properties for run time, not DB Simple Service Replacement

Next After EF Core 1.1 Parity with EF6.x New Capabilities Complex/value types Visual Studio wizard for reverse engineering Mapping to fields for navigation properties Simple type conversions New Capabilities

Composable is not just about Nuget packages EF is made up of 100’s of services Service i.e. class that has a single responsibility Detecting changes to an object since it was pulled from the database Taking a particular part of a linq query and translating it to sql Reuse a piece of EF Rowan uses type mapper as an example: var mapper=_context.GetService<IRelationalTypeMapper> Replace/tweak a piece of EF (1.1) protected internal override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder .ReplaceService<IModelCustomizer, CustomModelCustomizer>() .UseInMemoryDatabase();

My Picks To Share Change Tracker Familiar/Different In Memory Provider Migrations Enhancements Cross- Platform via .NET Core Logging Seed from JSON ASP.NET Core Integration Demos of field mapping, use EF services directly, replacing services, SQL Server Memory optimized table in Rowan M OnDotNet Demos of improved SQL generation, performance improvements,, targeting multiple databases in Rowan Miller Ignite video

Resources Demos are at https://github.com/julielerman/DevIntersection2016EFCore Rowan Miller (EF Program Mgr) - Entity Framework Core 1.1 https://channel9.msdn.com/Shows/On-NET/Rowan-Miller-Entity-Framework-Core-11 Rowan Miller - Access data in .NET Core 1.0 with Entity Framework https://channel9.msdn.com/Events/Ignite/2016/BRK2184 Pluralsight: Play by Play : EF Core First Look (bit.ly/PS_EFCoreLook) Coming soon: Getting Started with EF Core EF Docs: docs.efproject.net EFCore: github.com/aspnet/entityframework Arthur Vickers (team) blog: blog.oneunicorn.com Roadmap: bit.ly/efcoreroadmap MSDN Mag Data Points articles: bit.ly/datapointscolumn

@julielerman about.me/julielerman