• Save
Julie Lerman Agile Entity Framework (March 2010)
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Julie Lerman Agile Entity Framework (March 2010)

on

  • 4,484 views

The Visual Studio 2010 EDM designer and the .NET 4 Entity Framework runtime introduce a new story to Entity Framework - agile code. EF now supports POCOs, Persistence Ignorance, Unit Testing, Model ...

The Visual Studio 2010 EDM designer and the .NET 4 Entity Framework runtime introduce a new story to Entity Framework - agile code. EF now supports POCOs, Persistence Ignorance, Unit Testing, Model First development and even model-less development. THis is the latest version of this presentation given at www.go-esdc.com and East Bay.NET User group in early March 2010.

Statistics

Views

Total Views
4,484
Views on SlideShare
4,423
Embed Views
61

Actions

Likes
0
Downloads
0
Comments
0

3 Embeds 61

http://www.slideshare.net 57
http://www.mefeedia.com 3
http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Julie Lerman Agile Entity Framework (March 2010) Presentation Transcript

  • 1. Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
    Agile Entity Framework 4
    Julie Lerman
    thedatafarm.com/blog
    jlerman@thedatafarm.com
    Twitter @julielermanvt
  • 2. Julie Lerman
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
    website
    theDataFarm.com
    blog & twitter
    theDataFarm.com/blog@julielermanVT
    book web site
    LearnEntityFramework.com
    consultant/mentor
    Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader
    2nd Edition
    Spring 2010
  • 3. Agenda
    Agile Entities
    POCO Classes
    Leveraging Proxies
    Customizable T4 Code Generation
    Persistence Ignorance
    Agile Modeling
    Model-First
    (Model-less) Code-Only Development
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 4. ObjectContext Manages Entities
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
    ObjectContext
    Person Object
    State info
    State info
    Order Object
    State info
    Detail Object
    State info
    Detail Object
    State info
    Order Object
    State info
    Detail Object
    State info
    Detail Object
  • 5. Agile Entities in EF4
    EF3.5 Requires EntityObject
    Provides automated entity management
    Entities bound to EF API
    EF4 Adds POCO Support
    Smarter ObjectContext
    Loose Coupling
    Persistence Ignorance
    Repositories & Unit Testing
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 6. POCO: Shifting the Responsibility
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
    ObjectSet
    “Snapshot”
    ObjectContext
    POCO
    Classes
    DynamicProxy
    (similar to EntityObject)
    “Proxy Notification”
  • 7. Basic POCO Support
    Turn off code generation from EDMX
    “Convention” will auto-map classes/entities
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 8. POCO and Other EF Features
    Complex Types
    Use a class (no structs) to represent the type
    Explicit Loading
    ObjectContext.LoadProperty(myObj,”PropertyName”)
    ObjectContext.LoadProperty(myObj, o=>o.property)
    Lazy Loading (new to EF4)
    Virtual navigation properties get run-time proxy
    Two-Way Navigation
    Must be coded into classes
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 9. Dynamic Proxies
    Classes must be completely virtual
    Every single property
    Dynamic Proxy created at run time
    Provide features similar to EntityObject
    Change notification
    Relationship management
    Lazy Loading
    Lots of rules
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 10. Rules for Proxy Notification
    All properties must be virtual
    Use ICollection<T> for child collections
    ObjectContext.CreateObject<T> for new
    Class cannot be sealed
    Navigation properties cannot be sealed
    Class cannot be abstract
    Must have a constructor with no parameters
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 11. Code Gen POCOs from Model
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
    T4
    More in Kathleen Dollard’s 2:30 talk, Wednesday:
    T4: Code Generation Microsoft Style
    Text Template Transformation Toolkit
  • 12. Classes
    Persistence Ignorance/Repository
    System.Data.Entity
    Mock
    ObjectSet
    Mock
    Context A
    EDM &
    ObjectContext
    Mock
    Context B
    Class
    Repositories
    Class
    Repositories
    Class
    Repositories
    Class
    Repositories
    UI
    Tests
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 13. Agile Modeling in EF4
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
    *Available in separate download: EF Feature CTP
  • 14. Model First
    Define model
    Define entities, properties, property attributes
    Entity Keys, Identity Keys
    Field Type, Length, defaults.
    Relationships & their constraints (e.g. 1:*)
    Inheritance (TPT default)
    “Generate DB from Model” = Create DDL
    Run DDL against existing DB
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 15. Code-Only Design
    Part of the EF Feature CTP
    No model at all
    Metadata is inferred from classes
    Convention by Default
    EF will rely 100% on presumptions
    Configuration Follows
    Tweak configurations to modify behavior
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 16. Resources
    LearnEntityFramework.com/resources
    thedatafarm.com/blog/tags/ef4
    blogs.msdn.com/adonet, efdesign, dsimmons, alexj, more...
    msdn.microsoft.com/data
    Gateway to whitepapers, forums, documentation
    Lots of bloggers on EF now! Google! 
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
  • 17. Contact
    Julie Lerman: Agile Entity Framework 4 [ESDC March 2010]
    website
    theDataFarm.com
    blog & twitter
    theDataFarm.com/blog@julielermanVT
    book web site
    LearnEntityFramework.com
    consultant/mentor
    Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader