Core runtime in.NET Framework Newer runtime pieces out-of-band (NuGet) Tooling in Visual Studio...
-
Upload
scott-darrell-cook -
Category
Documents
-
view
242 -
download
0
Transcript of Core runtime in.NET Framework Newer runtime pieces out-of-band (NuGet) Tooling in Visual Studio...
Setting expectationsThis is a level 400 sessionAssumes prior knowledge of data access and EF
For getting started with EFhttp://bit.ly/EFTechEd2014
AgendaWhere are we at?A quick look at EF6, EF6.1 and EF6.1.1
Demos EF6 in action
Where are we going?What’s happening in EF7
Demos EF7 sneak peek
Versions
Entity Framework 3.5 SP1
Entity Framework 4
Entity Framework 4.1
Entity Framework 4.2
Entity Framework 4.3
Entity Framework 5
Entity Framework 6
Core runtime in .NET FrameworkNewer runtime pieces out-of-band (NuGet)Tooling in Visual Studio
Runtime in .NET FrameworkTooling in Visual Studio
Runtime out-of-band (NuGet)Tooling out-of-band (Microsoft Download Center)Latest version “chained in” to new Visual Studio releases
Entity Framework 6.1
Entity Framework 6.1.1
Entity Framework 7
What was new in EF6From the EF TeamAsynchronous query and saveConnection resiliencyCode-based configurationDatabase command interception/loggingCustom Code First conventionsCode First Insert, update, & delete stored proceduresNested entity typesImproved transaction SupportMultiple contexts per databaseDbModelBuilder.HasDefaultSchemaConfigurable migrations history tableCreating context with an open connectionEnums, spatial and better performance on .NET 4.0Default transaction isolation level changed to READ_COMMITTED_SNAPSHOT
From our contributors23 total contributionsCustom migrations operationsImproved warm up time for large modelsPluggable pluralization & singularization serviceDbModelBuilder.Configurations.AddFromAssemblyDbSet.AddRange/RemoveRange
What was new in EF6.1From the EF Team120+ bug fixesTooling consolidationHandling Transaction.Commit failures[Index] attributePublic mapping APIConfiguring interceptors in web/app.configImproved migrations change detectionFewer database operations during startup
From our contributors17 total contributionsSupport for String.Concat and .ToString in LINQ queries Support for enum HasFlags in LINQ queriesEntity SQL canonical functions for SQL Server Compact Improved support for EF on Mono
What’s coming in EF6.1.1From the EF Team47 bug fixes (and counting)
From our contributors12 total contributions (and counting)DbModelBuilder.Conventions.AddFromAssembly
Demo
Implementing soft deletesCommand tree interceptors (EF 6)Custom Code First conventions (EF 6)Model annotations (EF 6.1)Constructible DbUpdateCommandTree (EF 6.1.1)
dbo.Listings
ListingIdTitle DescriptionPriceIsDeleted
Listing
ListingId Title DescriptionPriceIsDeleted
Custom Conventio
n
public class Listing{ public int ListingId { get; set; } public string Title { get; set; } public string Description { get; set; } public int Price { get; set; }}
Model Builde
r
Query Pipeline
Database
var query = from l in db.Listings orderby l.Title select l;
SELECT * FROM dbo.Listings
db.Listings.Remove(listing);db.SaveChanges();
UpdatePipeline
Command Tree
Interceptor
DELETE FROM dbo.Listings …
Command Tree
Interceptor
WHERE IsDeleted = 0
[SoftDelete("IsDeleted")]public class Listing{ public int ListingId { get; set; } public string Title { get; set; } public string Description { get; set; } public int Price { get; set; } public bool IsDeleted { get; set; }}
SoftDeleteProperty: "IsDeleted"
UPDATE dbo.Listings …
Soft Deletes
Demo
Full text searchRaw SQL queries (EF 4)Custom migration operations (EF 6)Public mapping API (EF 6.1)
Demo
Enabling logging with recompilingRegistering interceptors in config (EF 6.1)DatabaseLogger (EF 6.1)
Entity Framework 7EF6 supported scenariosFull .NET Framework (ASP.NET & traditional desktop applications)Relational databases
EF7 enabling new scenariosNew platforms (Windows Phone, Windows Store, etc.)New data stores (Non-relational)
Challenges with current code baseLong history going back to the WinFS daysExtensive use of older APIs and design patternsHeavy use of APIs not available on all platforms Lots of seldom used code/featuresMonolithic implementationUnintuitive behaviors woven throughout code base
Not optimized for density/devicesHigh memory footprint
Tight coupling to relational concepts
What we are doingLightweight, extensible version of EF Just the commonly used features (and many new features)Built using modern design patternsDbContext and Code First only
Not a micro-O/RMStill supports LINQ, change tracking, unit of work, etc.
Support relational & non-relational storesNot a high level abstraction over all data storesProvide high level services that are useful on all/most storesNon-common concerns handled by provider extensions
Design principlesKeep EF6 patternsOnly break from existing patterns where there is good reason
Pay per playSimpler apps will require fewer resourcesLow memory footprint
ExtensibleSimple high level API over building blocksEasy to replace/extend individual building blocks as needed
Sensible defaults, less magicOnly support magic where it supports long term success
What about EF6 apps?You don’t have to upgradeEF6 is still supportedUpdates to EF6 will continue (we’ve done EF6.1 and EF6.1.1 in parallel with EF7)
Not all EF6 features will be in 7.0.0We don’t expect everyone to be able to upgrade immediately
Upgrade is a key scenarioSame concepts, same patternsSome code changes will be needed
Get involved in EF7Open sourceSee http://bit.ly/EFTechEd2014 for links
Nightly builds now availableSee http://bit.ly/EFTechEd2014 for links
DEV-B356 Industrial-Strength Entity Framework
Related content
Find Me Later At Developer Tools Booth
Visit the Developer Platform & Tools BoothHaving a friend buy your coffee?Yea, it’s kind of like that.
MSDN Subscribers get up to $150/mo in Azure credits.
Stop by the Developer Platform and Tools booth and visit the MSDN Subscriptions station to activate your benefits and receive a gift!
http://aka.ms/msdn_teched
3 Steps to New Gear! With Application Insights
1. Create a Visual Studio Online account http://visualstudio.com
2. Install Application Insights Tools for Visual Studio Online http://aka.ms/aivsix
3. Come to our booth for a t-shirt and a chance to win!
VSIP QR Tag Contests Visit our booth to join the hunt for cool prizes!
Alex Park
ResourcesMicrosoft Engineering Stories
How Microsoft Builds Softwarehttp://aka.ms/EngineeringStories
Visual Studio Industry Partner Program
Meet Our New Visual Studio Online Partners or Join Now.http://vsipprogram.com
Visual Studio | Integrate
Create Your Own Dev Environmenthttp://integrate.visualstudio.com
Development tools & services for teams of all sizeshttp://www.visualstudio.com
© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.