Building n-Tier ASP.NET WebForms with Entity Framework 4, Lerman

  • 7,974 views
Uploaded on

New England Code Camp 14 presentation on tips & tricks for using new features in EF4 when building WebForms applications with Entity Framework. by Julie Lerman.

New England Code Camp 14 presentation on tips & tricks for using new features in EF4 when building WebForms applications with Entity Framework. by Julie Lerman.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
7,974
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
0
Comments
0
Likes
2

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
  • Abtract: Creating n-tier applications with Entity Framework got a whole lot easier in .NET 4.0. But if you are using ASP.NET Web Forms, there are still some tricks that you’ll need to know, especially if you are not a fan of using the binding sources, such as EntityDataSource and ObjectDataSource. In this session, you’ll see how to create a bridge between your Web Forms and a repository which serves up Entity Framework entities. You’ll lean some of the tools you’ll need to handle related datasuch as master-detail and foreign key

Transcript

  • 1. Building n-Tier ASP.NET Web Forms with Entity Framework
    Julie Lermanthedatafarm.com
    jlerman@thedatafarm.com
    Twitter @julielerman
  • 2. Julie Lerman
    consultant/mentor
    Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader
    website
    theDataFarm.com
    blog & twitter
    theDataFarm.com/blog@julielerman
    book web site
    LearnEntityFramework.com
    2nd Edition (EF4) is now available
  • 3. Agenda
    EF Challenges in Web Apps
    Review WebForm Options with EF
    EF4 Tools to the Rescue
    POCOs and Repositories
    Leveraging Foreign Keys
    Putting it all together
  • 4. The ASP.net Spectrum with EF
    Dynamic Data forEntities
    ObjectDataSource
    EntityDataSource
    MVC
    ADO.NET
    Data
    Services
    Dev
    WCF
    n-Tier
    Architect
  • 5. Change Tracking Across Tiers
    ObjectContext
    ObjectStateEntry
    SO1 EntityKey Original ValuesCurrent Values Other ∆ Info
    ObjectStateEntry
    SO2 EntityKeyOriginal ValuesCurrent ValuesOther ∆ Info
    detach
    entities
    ObjectStateEntry
    LIA EntityKeyOriginal ValuesCurrent ValuesOther ∆ Info
    Original Property Values
    EntityState Values
    ObjectStateEntry
    LIB EntityKeyOriginal ValuesCurrent ValuesOther ∆ Info
  • 6. SaveChanges Fails Across Post Backs
    Page Request
    Post Back #1
    Post Back #2
    New Page Class
    New Page Class
    New Page Class
    Create New ObjectContext
    Create NewObjectContext
    Create NewObjectContext
    Get Entities
    Process Request
    Get Entities
    Build HTML using Data & ASP.NET Markup
    Build HTML using Data & ASP.NET Markup
    Build HTML using Data & ASP.NET Markup
    Destroy Page and Dependents
    Destroy Page and Dependents
    Destroy Page and Dependents
  • 7. EF4 Changes to the Rescue
    Foreign Keys
    Big help for selected list values on postback
    State Methods
    ApplyCurrentValues, ApplyOriginalValues
    ChangeState
    ChangeRelationshipState (when no FKs)
    POCO Classes & T4 Generation
  • 8. What about?
    Graphs
    Lazy Loading
    Returning IQueryables
    Change
    Tracking
  • 9. POCO Basics
    With or without code gen from EDMX
    “Convention” will auto-map classes/entities
  • 10. EF Related Architectural Choices
    Classes
    vs.
    Repositories
    vs.
  • 11. Basic Pattern for ASP.NET n-Tier
    Code Behind
    Business Logic
    Repository
    Transient ObjectContext, Queries
    CacheEntityKeys, Scalars (inc FKs)
    Foreign Keys make this
    approach a possibility
    Entity Framework
  • 12. Julie Lerman
    consultant/mentor
    Microsoft MVP, INETA Speaker,ASPInsider, MCP, VTdotNET Leader
    website
    theDataFarm.com
    blog & twitter
    theDataFarm.com/blog@julielerman
    book web site
    LearnEntityFramework.com
    2nd Edition (EF4) is now available
  • 13. Your Feedback is Important
    Please fill out a session evaluation form drop it off at the conference registration desk.
    Thank you!