Entity Framework - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Entity Framework

Description:

Should allow for mapping to non-relational data, such as OLAP ... Still not totally persistent ignorant, but best we have till Beta 3. 9. The ObjectContext ... – PowerPoint PPT presentation

Number of Views:1472
Avg rating:3.0/5.0
Slides: 14
Provided by: Jam9159
Category:

less

Transcript and Presenter's Notes

Title: Entity Framework


1
Entity Framework
  • James Winters

2
Agenda
  • Why?
  • What is it?
  • How do you use it?
  • Where do you get more info?

3
Is EF just another ORM?
  • Yes and No ?
  • Entity Domain Model is a very flexible Mapper
  • Should allow for mapping to non-relational data,
    such as OLAP
  • Out of the box all the samples are ORM
  • Mapping the database to the domain model is
    currently all EF tooling does
  • You can hand craft though
  • Provides mechanisms to create own Providers
  • Or more likely to download vendor created
    providers

4
Architecture
Applications
Programming Layers
Code Gen
  • Linq to Entities
  • Entity SQL

Binding
Entity Client EDM, Entity SQL
Domain Modeling Tools
Query and Update Pipelines
Metadata Services
Mapping
Mapping
Entity Framework Runtime
Transactions
Modeling
Data Providers (ADO.NET patterns)
SqlClient
OtherClient
Non-relational
Web Service
5
Logical Model
Object Model (O Space)
Linq
Mapped via Attributes Or IPOCO
Conceptual Model (C - Space)
ADO. Net Provider e.g.EntityClient
Mapped via EDMGen or tools
Store Model (S-Space)
ADO. Net Provider e.g. SqlClient
6
How is the model stored
  • As metadata in XML
  • 3 files
  • .CSDL (Conceptual Schema Definition Language)
  • Maps the entity types that you use in your
    conceptual model
  • .SSDL (Store Schema Definition Language)
  • What the DB looks like
  • .MSL (Mapping Schema Language)
  • Maps the CSL to the SSDL
  • Created by Designer tool
  • Or use EMDGen
  • Must be available to the runtime
  • Copy in to bin folder, or use embedded resource
    build option

7
Entity Data Model
  • Tooling provided in CTP 1
  • Will be much improved in CTP 2

8
Querying
  • 4 strategies
  • Use the EntityClient Provider
  • Query C-Space using ADO.Net techniques and Entity
    SQL
  • Query the Object Model
  • Use ObjectQueryltTgt and Entity SQL to create
    objects
  • Uses ObjectContext to provide the container
  • Use the generated container to generate objects
  • Still data oriented, but less so
  • Use Linq to Entities
  • Still not totally persistent ignorant, but best
    we have till Beta 3

9
The ObjectContext
  • Can be thought of as the Object Services manager
  • Encapsulates the mapping and manages the CRUD
  • Tracks state via the ObjectStateManager
  • Switch it off for read only via
    MergeOptions.NoTracking
  • Entities have one of 5 states
  • Added
  • Deleted
  • Modified
  • Unchanged
  • Detached

10
Persisting Change
  • When you call SaveChanges()
  • ObjectContext calculates CRUD options by
    examining Entity collection and querying state
  • Concurrency?
  • Transactions?
  • Optimisation?

11
Stored Procedures
  • For now you have to provide the function
    declaration in C-Space
  • And also the mappings to S-Space
  • Complex type mappings are also hand cranked for
    now
  • Simple 1-1 mappings only
  • Tools in CTP2 have SP and complex type mapping
    support

12
References
  • My Blog
  • http//www.wintersfamily.plus.com/blogs/JamesWinte
    rs/
  • ADO.Net Team Blog
  • http//blogs.msdn.com/adonet/
  • The Entity Framework FAQ
  • http//blogs.msdn.com/dsimmons/pages/entity-framew
    ork-faq.aspx

13
Summary
  • Shows great promise
  • It will be the data access technology of choice
  • Unless Linq to Hibernate takes off
  • Tooling needs to improve
  • Or write your own ?
Write a Comment
User Comments (0)
About PowerShow.com