ADO.NET Entity Framework

16
ADO.NET ENTITY FRAMEWORK Clint Edmonson & Josh Gillespie Polaris Solutions Accretive Health Developer Days

description

Introduction to Microsoft's ADO.NET Entity Framework 5.

Transcript of ADO.NET Entity Framework

ADO.NET E N T I T Y F RA M E W O R K

Clint Edmonson & Josh GillespiePolaris Solutions

Accretive Health Developer Days

AGENDA

• Introduction to EF 5

• Development Approaches

• Tips & Tricks

• What’s coming in EF 6

INTRODUCTION

• EntityFramework NuGet Package

• Included in Visual Studio 2012

• Works with Visual Studio 2010

• Works with .NET 4.0 and 4.5• Most new features require .NET 4.5

ENTITY FRAMEWORK 5 (EF5)

• EF designer and code first• Enum support• Spatial data types• Performance improvements

• EF designer only• Table-valued Functions (TVFs)• Multiple diagrams and coloring• DbContext code generation

NEW IN EF5

NewDatabase

ExistingDatabase

Design First

Database FirstReverse engineer model in EF DesignerClasses auto-generated from model

Model FirstCreate model in EF DesignerGenerate database from modelClasses auto-generated from model

DEVELOPER WORKFLOWSCode First

Code FirstDefine classes and mapping in codeEF Power Tools provide reverse engineer

Code FirstDefine classes and mapping in codeDatabase created from codeMigrations apply model changes to database

EF ARCHITECTURE

• Providers

• Context

• Set

• Entities

TIPS & TRICKS

ADVANCED TECHNIQUES

• Enums

• Complex Types

• Many to Many relationships

• Proxies & Lazy loading

TIPS & TRICKS

• Stored procedures and raw SQL calls

• EF Power Tools

• SQL statement profiling

• DbSet.AsNoTracking

• IQueryable.Load()

• IQueryable.ToList()

• DbSet.Local

OTHER CONSIDERATIONS…

• Transactions

• Unit testing

• Service boundaries

• Concurrency

• Entity mapping strategies

• Async query and save

• Dependency injection pattern

• Code first custom conventions

• Enums, spatial, etc. on .NET 4.0

• Connection resiliency (retry)

• Tooling consolidation

• Code first stored procedure support

COMING IN EF6

QUESTIONS?

THANK YOU!Clint Edmonson

[email protected]

Josh Gillespie

[email protected]

APPENDIX