270 likes | 480 Views
Dive into Entity Framework Core 2.0 with demos showcasing DbContext pooling, compiled queries, and function mapping. Learn about new features like query filters, owned entities, and table splitting. Understand the EF roadmap from version 1.0 to 2.1.
E N D
Entity Framework Core 2.0 Diego Vega, Andrew Peters @divega, @anpete
About today’s session • EF versions & flavors • EF Core 2.0 • Demos • Roadmap
Entity Framework versions & flavors Entity Framework O/R Mapper for .NET Framework Entity Framework Core Lightweight, extensible, cross-platform O/R Mapper for .NET Standard EF 6.2 (released last week) EF Core 2.1 (first half of 2018) EF 6.0 – 6.1.3 (2013 – 2015) EF Core 2.0 (2017) EF 4.1 to 5.0 (2011 – 2012) EF Core 1.0 – 1.1 (2016) EF 4.0 (2010) EF 1.0 (2008)
Performance DbContext pooling Compiled queries Architecture improvements Entity Framework Core 2.0 Themes • Runs everywhere • .NET Standard 2.0 • New features • Query filters • Function mapping • Owned entities • Table splitting
DbContext per Request publicclassBlogsController : Controller { privateBlogContext _context; publicBlogsController(BlogContext context) { _context = context; } publicIActionResult Index() { return _context.Blogs.ToList(); } } DI Container Request: /blogs/index Request: /blogs/index BlogContext Blogs Controller BlogContext Blogs Controller Scope Scope Request: /blogs/index BlogContext Blogs Controller Scope
DbContext Pooling publicclassBlogsController : Controller { privateBlogContext _context; publicBlogsController(BlogContext context) { _context = context; } publicIActionResult Index() { return _context.Blogs.ToList(); } } DI Container Request: /blogs/index Context Pool Scope BlogContext Blogs Controller Scope BlogContext BlogContext BlogContext BlogContext Request: /blogs/index BlogContext BlogContext Blogs Controller Scope Request: /blogs/index BlogContext Blogs Controller Scope
Lazy loading Value conversions Lifecycle events Non-default constructors Update model from database Column ordering Perf investigation UWP testing EF Core 2.1 – Planned Features • GroupBy • Seeding • View types • Include for derived types • System.Transactions • Cosmos DB provider • Sample Oracle provider • App insights integration
References • Demos https://github.com/anpete/efdemos • Project https://github.com/aspnet/EntityFrameworkCore • EF Core docs https://docs.microsoft.com/ef/core • Twitter @divega @anpete @efmagicunicorns • Blog https://blogs.msdn.microsoft.com/dotnet/
Please use EventsXD to fill out a session evaluation. Thank you! Questions?