Your SlideShare is downloading. ×
0
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Julie Lerman Agile Entity Framework (March 2010)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Julie Lerman Agile Entity Framework (March 2010)

2,720

Published on

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.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,720
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

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

×