Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Entity
Framework
Rowan Miller
Setting expectations
This is a level 400 session
Assumes prior knowledge of data access and EF
Agenda
Where are we at?
A quick look at EF6, EF6.1 and EF6.1.1
Demos
EF6 in action
Demos
EF7 sneak peek
Versions
Entity
Entity
6.1.1
Entity
Framework 7
Framework
Framework 6.1
Entity Framework 6
Entity Framework 5
Entity Framework 4.3
Entity Framework 4.2
Demos | EF6 in
action
Demo
Implementing soft deletes
Command tree interceptors (EF 6)
Custom Code First conventions (EF 6)
Model annotations (EF 6.1)
Constructible DbUpdateCommandTree (EF 6.1.1)
Soft Deletes
public
class Listing
[SoftDelete("IsDeleted")]
{
public class Listing
{ public int ListingId { get; set; }
public string
Title {{get;
int ListingId
get;set;
set;}}
public string Description
get;}set;
Title { get;{ set;
} public string Description { get;
public
int Price { get; set; }
set;
}
} public int Price { get; set; }
public bool IsDeleted { get; set; }
}
var query = from l in db.Listings
orderby l.Title
select l;
Custom
Conventio
n
Model
Builde
r
Listing
Query
Pipeline
Command
Tree
Interceptor
db.Listings.Remove(listing);
db.SaveChanges();
Update
Pipeline
Command
Tree
Interceptor
ListingId
Title
Description
Price
IsDeleted
SoftDeleteProperty:
"IsDeleted"
dbo.Listings
ListingId
Title
Description
Price
IsDeleted
Databas
e
UPDATE
DELETE
FROM dbo.Listings
dbo.Listings
Demo
Full text search
Raw SQL queries (EF 4)
Custom migration operations (EF 6)
Public mapping API (EF 6.1)
Demo
Testing without hitting a database
Mockable DbSet<T> (EF 6)
Demo
Enabling logging with recompiling
Registering interceptors in config (EF 6.1)
DatabaseLogger (EF 6.1)
Demo
Tooling consolidation
Entity Framework 7
EF6 supported scenarios
Full .NET Framework (ASP.NET & traditional desktop applications)
Relational databases
Not a micro-O/RM
Still supports LINQ, change tracking, unit of work, etc.
Design principles
Keep EF6 patterns
Only break from existing patterns where there is good reason
Extensible
Simple high level API over building blocks
Easy to replace/extend individual building blocks as needed
Demo
New data stores
Demo
New platforms
Related content
DEV-B356 Industrial-Strength Entity
Framework
Find Me Later At Developer Tools Booth
Alex Park
http://aka.ms/msdn_teched
1. Create a
Visual Studio
Online
account
http://visualstudio.c
om
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!
Resources
Microsoft Engineering
Stories
Development tools & services for teams
of all sizes
http://www.visualstudio.com
Visual Studio
Industry Partner
Program
Meet Our New Visual Studio Online
Partners
or Join Now.
http://vsipprogram.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.