• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Entity Framework 4 and WCF
 

Entity Framework 4 and WCF

on

  • 10,743 views

This presentation walks through the new features of Entity Framework in Visual Studio 2010 & .NET 4 that simplify using entities in WCF. The live session demo'd the features and a WCF service with a ...

This presentation walks through the new features of Entity Framework in Visual Studio 2010 & .NET 4 that simplify using entities in WCF. The live session demo'd the features and a WCF service with a client consumer.

Statistics

Views

Total Views
10,743
Views on SlideShare
10,658
Embed Views
85

Actions

Likes
2
Downloads
0
Comments
0

2 Embeds 85

http://www.slideshare.net 84
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

    Entity Framework 4 and WCF Entity Framework 4 and WCF Presentation Transcript

    • Entity Framework 4 & WCF So Happy Together
      Julie Lerman
      www.thedatafarm.com
      jlerman@thedatafarm.com
      twitter @JulieLermanVT
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • Julie Lerman
      website
      theDataFarm.com
      blog & twitter
      theDataFarm.com/blog@julielermanVT
      book web site
      LearnEntityFramework.com
      consultant/mentor
      Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
      2nd Edition
      Spring 2010
    • Agenda
      New Features in EF that help with n-Tier
      POCO Support
      Foreign Keys
      State methods
      Serialization improvement
      Custom WCF Services
      Self-Tracking Entities
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • EFv1 and N-Tier
      EntityObjects are ugly when serialized
      Transferring to & from DTOs is painful
      No change-tracking in the objects
      Difficult & unsatisfying WCF patterns
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • ObjectContext Manages Entities
      Julie Lerman: Entity Framework 4 and WCF [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
    • Hello POCO, Goodbye EntityObject
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • Code Gen POCOs from Model
      T4
      More in Kathleen Dollard’s 2:30 talk, Wednesday:
      T4: Code Generation Microsoft Style
      Text Template Transformation Toolkit
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • New State Methods Support N-Tier
      Fix up newly attached entity’s EntityState
      ApplyCurrentValues
      ApplyOriginalValues
      ChangeState
      ChangeRelationshipState
      Used when there are no foreign keys
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • Context.ApplyCurrentValues
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
      Server Entity
      • Managed by Context
      • EntityState=Unchanged
      Client side Entity
      • EntityState=Modified
      ApplyCurrentValues(Client Entity)
    • Foreign Key Support
      Default with new models
      Simplifies relationship management
      Huge benefits from WCF client to service
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • Basic Pattern for WCF in EF4
      Use POCO entity classes
      No dynamic proxies (not virtual)
      Include a State property in the classes
      Return graphs
      Attach returned data to new context
      Fix up context state using POCO State
      If not using FKs
      Fix up relationships with help from DB data
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • Self-Tracking Entities (! very agile)
      For DataSet lovers
      Special T4 Code Gen Template
      Creates POCO Classes with state info
      Creates additional classes & interfaces
      “Magically: takes care of change tracking
      Used in client (.NET 4.0) & service
      For WCF/DataContract Serialization
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • Summary
      WCF was painful in EF version 1
      Many improvements in EF4 to help n-Tier
      Writing custom WCF gets much easier
      Self-Tracking Entities are an out of the box solution to help DataSetdevs
      Don’t forget about WCF Data Services and WCF RIA Services as well
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
    • Julie Lerman
      website
      theDataFarm.com
      blog & twitter
      theDataFarm.com/blog@julielermanVT
      book web site
      LearnEntityFramework.com
      consultant/mentor
      Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]
      2nd Edition
      Spring 2010
    • Resources
      Julie Lerman: Entity Framework 4 and WCF [ESDC March 2010]