SlideShare a Scribd company logo
1 of 9
Download to read offline
Entity Framework
(EF)
Eng. Mahmoud Ouf
Lecture 1
mmouf@2017
What Is the Entity Framework?
• The Entity Framework is a set of technologies in ADO.NET that helps
fill in the space between object oriented development (objects) and
databases.
• This gap is commonly known as an “impedance mismatch” and it
exists because the mapping and organization of classes does not quite
match up to the organization of relational objects.
mmouf@2017
What Is the Entity Framework?(cont.)
• It generates business objects and entities according to the database
tables and provides the mechanism for:
1. Performing basic CRUD (Create, Read, Update, Delete) operations.
2. Easily managing "1 to 1", "1 to many", and "many to many"
relationships.
3. Ability to have inheritance relationships between entities.
mmouf@2017
What are the benefits of using it?
1. We can have all data access logic written in higher level languages.
2. The conceptual model can be represented in a better way by using
relationships among entities.
3. The underlying data store can be replaced without much overhead
since all data access logic is present at a higher level.
mmouf@2017
Is it an alternative to ADO.NET?
• Yes because the developer will not be writing ADO.NET methods and
classes for performing data operations.
• No because this model is actually written on top of ADO.NET,
meaning under this framework, we are still using ADO.NET.
mmouf@2017
The Entity Framework Architecture
Application
Entity Framework
Entity Data Model (EDM)
Describe Object Relational Mapping
ADO .NET Provider
Data Store
ORM Interface
mmouf@2017
Entity Data Model
• The Entity Data Model (EDM) is the foundation of the Entity
Framework and is comprised of the three Layers
• These three layers allow data to be mapped from a relational database
to a more object-oriented business model.
• ADO.NET EF 3.5 defines these layers using XML files. These XML
files provide a level of abstraction so developers can program against
the OO conceptual model instead of the traditional relational data
model.
mmouf@2017
Entity Data Model(Cont.)
• The conceptual Layer:
Is defined in an XML file using Conceptual Schema Definition Language
(CSDL). CSDL defines the entities and the relationships as the application’s
business layer knows them.
• The Storage (logical) Layer:
Which represents the database schema, is defined in an XML file using Store
Schema Definition Language (SSDL)
• The Mapping Layer:
Which is defined using Mapping Schema Language (MSL), maps the other two
layers. This mapping is what allows developers to code against the conceptual
model and have those instructions mapped into the logical model.
mmouf@2017
Creating EDM:
• From the beginning of EF, you could generate the EDM from an existing
Database.
• Starting from Visual Studio 2010 and .Net Framework 4.0, there was a
significant improvement regarding the creation of EDM. Now we have
three ways for creating an EDM:
1)Database First: this is the traditional way by creating the EDM from Existing
Database.
2)Model First: Allows you to start with an empty model, define your model and then
generate the database, mappings, and classes from the defined model.
3)Code Only: Allows you to use the Entity Framework using Plain Old CLR Objects
(POCO) entities and without an EDMX file
mmouf@2017

More Related Content

What's hot

Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
Doncho Minkov
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
Connex
 

What's hot (20)

Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
LINQ
LINQLINQ
LINQ
 
Introduction to c++ ppt
Introduction to c++ pptIntroduction to c++ ppt
Introduction to c++ ppt
 
GSP 125 Final Exam Guide
GSP 125 Final Exam GuideGSP 125 Final Exam Guide
GSP 125 Final Exam Guide
 
Linq
LinqLinq
Linq
 
Linq
LinqLinq
Linq
 
GSP 125 Final Exam Guide
GSP 125 Final Exam GuideGSP 125 Final Exam Guide
GSP 125 Final Exam Guide
 
Function overloading ppt
Function overloading pptFunction overloading ppt
Function overloading ppt
 
Gsp 125 final exam guide
Gsp 125 final exam guideGsp 125 final exam guide
Gsp 125 final exam guide
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
C Programming: Structure and Union
C Programming: Structure and UnionC Programming: Structure and Union
C Programming: Structure and Union
 
Module 3: Introduction to LINQ (PowerPoint Slides)
Module 3: Introduction to LINQ (PowerPoint Slides)Module 3: Introduction to LINQ (PowerPoint Slides)
Module 3: Introduction to LINQ (PowerPoint Slides)
 
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course AhmedabadIntroduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
 
Language Integrated Query - LINQ
Language Integrated Query - LINQLanguage Integrated Query - LINQ
Language Integrated Query - LINQ
 
.NET presentation
.NET presentation.NET presentation
.NET presentation
 
Class and object
Class and objectClass and object
Class and object
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
Dynamic Memory Allocation, Pointers and Functions, Pointers and Structures
Dynamic Memory Allocation, Pointers and Functions, Pointers and StructuresDynamic Memory Allocation, Pointers and Functions, Pointers and Structures
Dynamic Memory Allocation, Pointers and Functions, Pointers and Structures
 
LINQ in C#
LINQ in C#LINQ in C#
LINQ in C#
 
GSP 125 Entire Course NEW
GSP 125 Entire Course NEWGSP 125 Entire Course NEW
GSP 125 Entire Course NEW
 

Viewers also liked

Analysis of the use of sound in previous
Analysis of the use of sound in previousAnalysis of the use of sound in previous
Analysis of the use of sound in previous
Ezgi Cicek
 
From the Big Bang to Ecommerce, a journey in making sense of Big Data
From the Big Bang to Ecommerce, a journey in making sense of Big DataFrom the Big Bang to Ecommerce, a journey in making sense of Big Data
From the Big Bang to Ecommerce, a journey in making sense of Big Data
Patrick Deglon
 
Fluent Refactoring (Cascadia Ruby Conf 2013)
Fluent Refactoring (Cascadia Ruby Conf 2013)Fluent Refactoring (Cascadia Ruby Conf 2013)
Fluent Refactoring (Cascadia Ruby Conf 2013)
Sam Livingston-Gray
 

Viewers also liked (17)

Tratado de Neuilly
Tratado de NeuillyTratado de Neuilly
Tratado de Neuilly
 
HRM Management Institute
HRM Management InstituteHRM Management Institute
HRM Management Institute
 
Scikit-Learn para MLLib: Machine Learning em Larga Escala
Scikit-Learn para MLLib: Machine Learning em Larga EscalaScikit-Learn para MLLib: Machine Learning em Larga Escala
Scikit-Learn para MLLib: Machine Learning em Larga Escala
 
COMO PINTO ACRILICO
COMO PINTO ACRILICOCOMO PINTO ACRILICO
COMO PINTO ACRILICO
 
Gruppo di famiglia in un interno facebook
Gruppo di famiglia in un interno facebookGruppo di famiglia in un interno facebook
Gruppo di famiglia in un interno facebook
 
JOMC slide deck
JOMC slide deckJOMC slide deck
JOMC slide deck
 
Analysis of the use of sound in previous
Analysis of the use of sound in previousAnalysis of the use of sound in previous
Analysis of the use of sound in previous
 
Information Mapping (1)
Information Mapping (1)Information Mapping (1)
Information Mapping (1)
 
From the Big Bang to Ecommerce, a journey in making sense of Big Data
From the Big Bang to Ecommerce, a journey in making sense of Big DataFrom the Big Bang to Ecommerce, a journey in making sense of Big Data
From the Big Bang to Ecommerce, a journey in making sense of Big Data
 
Fluent Refactoring (Cascadia Ruby Conf 2013)
Fluent Refactoring (Cascadia Ruby Conf 2013)Fluent Refactoring (Cascadia Ruby Conf 2013)
Fluent Refactoring (Cascadia Ruby Conf 2013)
 
DEFINICIÓN SOBRE EL AMOR
DEFINICIÓN SOBRE EL AMORDEFINICIÓN SOBRE EL AMOR
DEFINICIÓN SOBRE EL AMOR
 
Dilasa
DilasaDilasa
Dilasa
 
Affiches de la famille
Affiches de la familleAffiches de la famille
Affiches de la famille
 
1. prepare usb installer
1.  prepare usb installer1.  prepare usb installer
1. prepare usb installer
 
Training & workshop lesson plan medea ocotber 21st 2014
Training & workshop lesson plan  medea ocotber 21st 2014 Training & workshop lesson plan  medea ocotber 21st 2014
Training & workshop lesson plan medea ocotber 21st 2014
 
Bmw museum
Bmw museumBmw museum
Bmw museum
 
Bahasa Mandarin Dasar
Bahasa Mandarin DasarBahasa Mandarin Dasar
Bahasa Mandarin Dasar
 

Similar to Intake 37 ef1

Improved Presentation and Facade Layer Operations for Software Engineering Pr...
Improved Presentation and Facade Layer Operations for Software Engineering Pr...Improved Presentation and Facade Layer Operations for Software Engineering Pr...
Improved Presentation and Facade Layer Operations for Software Engineering Pr...
Dr. Amarjeet Singh
 
Document Based Data Modeling Technique
Document Based Data Modeling TechniqueDocument Based Data Modeling Technique
Document Based Data Modeling Technique
Carmen Sanborn
 
Office automation system report
Office automation system reportOffice automation system report
Office automation system report
Amit Kulkarni
 
Office automation system report
Office automation system reportOffice automation system report
Office automation system report
Amit Kulkarni
 
Discussion post· The proper implementation of a database is es.docx
Discussion post· The proper implementation of a database is es.docxDiscussion post· The proper implementation of a database is es.docx
Discussion post· The proper implementation of a database is es.docx
madlynplamondon
 
data base system to new data science lerne
data base system to new data science lernedata base system to new data science lerne
data base system to new data science lerne
tarunprajapati0t
 

Similar to Intake 37 ef1 (20)

Intake 38 data access 4
Intake 38 data access 4Intake 38 data access 4
Intake 38 data access 4
 
Entity Framework
Entity FrameworkEntity Framework
Entity Framework
 
Improved Presentation and Facade Layer Operations for Software Engineering Pr...
Improved Presentation and Facade Layer Operations for Software Engineering Pr...Improved Presentation and Facade Layer Operations for Software Engineering Pr...
Improved Presentation and Facade Layer Operations for Software Engineering Pr...
 
A Comparative Study of RDBMs and OODBMs in Relation to Security of Data
A Comparative Study of RDBMs and OODBMs in Relation to Security of DataA Comparative Study of RDBMs and OODBMs in Relation to Security of Data
A Comparative Study of RDBMs and OODBMs in Relation to Security of Data
 
Ef overview
Ef overviewEf overview
Ef overview
 
Document Based Data Modeling Technique
Document Based Data Modeling TechniqueDocument Based Data Modeling Technique
Document Based Data Modeling Technique
 
Comparison of Relational Database and Object Oriented Database
Comparison of Relational Database and Object Oriented DatabaseComparison of Relational Database and Object Oriented Database
Comparison of Relational Database and Object Oriented Database
 
DBMS-Unit-1.pptx
DBMS-Unit-1.pptxDBMS-Unit-1.pptx
DBMS-Unit-1.pptx
 
DDD
DDDDDD
DDD
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
Office automation system report
Office automation system reportOffice automation system report
Office automation system report
 
Office automation system report
Office automation system reportOffice automation system report
Office automation system report
 
Cse ii ii sem
Cse ii ii semCse ii ii sem
Cse ii ii sem
 
In Memory Database Essay
In Memory Database EssayIn Memory Database Essay
In Memory Database Essay
 
Discussion post· The proper implementation of a database is es.docx
Discussion post· The proper implementation of a database is es.docxDiscussion post· The proper implementation of a database is es.docx
Discussion post· The proper implementation of a database is es.docx
 
data base system to new data science lerne
data base system to new data science lernedata base system to new data science lerne
data base system to new data science lerne
 
Database Management System, Lecture-1
Database Management System, Lecture-1Database Management System, Lecture-1
Database Management System, Lecture-1
 
Database-management-system-dbms-ppt.pptx
Database-management-system-dbms-ppt.pptxDatabase-management-system-dbms-ppt.pptx
Database-management-system-dbms-ppt.pptx
 
Database Systems Concepts, 5th Ed
Database Systems Concepts, 5th EdDatabase Systems Concepts, 5th Ed
Database Systems Concepts, 5th Ed
 
02010 ppt ch02
02010 ppt ch0202010 ppt ch02
02010 ppt ch02
 

More from Mahmoud Ouf (20)

Relation between classes in arabic
Relation between classes in arabicRelation between classes in arabic
Relation between classes in arabic
 
Intake 38 data access 5
Intake 38 data access 5Intake 38 data access 5
Intake 38 data access 5
 
Intake 38 data access 1
Intake 38 data access 1Intake 38 data access 1
Intake 38 data access 1
 
Intake 38 12
Intake 38 12Intake 38 12
Intake 38 12
 
Intake 38 11
Intake 38 11Intake 38 11
Intake 38 11
 
Intake 38 10
Intake 38 10Intake 38 10
Intake 38 10
 
Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
 
Intake 38 8
Intake 38 8Intake 38 8
Intake 38 8
 
Intake 38 7
Intake 38 7Intake 38 7
Intake 38 7
 
Intake 38 6
Intake 38 6Intake 38 6
Intake 38 6
 
Intake 38 5 1
Intake 38 5 1Intake 38 5 1
Intake 38 5 1
 
Intake 38 5
Intake 38 5Intake 38 5
Intake 38 5
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
Intake 38 2
Intake 38 2Intake 38 2
Intake 38 2
 
Intake 37 DM
Intake 37 DMIntake 37 DM
Intake 37 DM
 
Intake 37 12
Intake 37 12Intake 37 12
Intake 37 12
 
Intake 37 11
Intake 37 11Intake 37 11
Intake 37 11
 
Intake 37 10
Intake 37 10Intake 37 10
Intake 37 10
 
Intake 37 9
Intake 37 9Intake 37 9
Intake 37 9
 
Intake 37 8
Intake 37 8Intake 37 8
Intake 37 8
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Intake 37 ef1

  • 1. Entity Framework (EF) Eng. Mahmoud Ouf Lecture 1 mmouf@2017
  • 2. What Is the Entity Framework? • The Entity Framework is a set of technologies in ADO.NET that helps fill in the space between object oriented development (objects) and databases. • This gap is commonly known as an “impedance mismatch” and it exists because the mapping and organization of classes does not quite match up to the organization of relational objects. mmouf@2017
  • 3. What Is the Entity Framework?(cont.) • It generates business objects and entities according to the database tables and provides the mechanism for: 1. Performing basic CRUD (Create, Read, Update, Delete) operations. 2. Easily managing "1 to 1", "1 to many", and "many to many" relationships. 3. Ability to have inheritance relationships between entities. mmouf@2017
  • 4. What are the benefits of using it? 1. We can have all data access logic written in higher level languages. 2. The conceptual model can be represented in a better way by using relationships among entities. 3. The underlying data store can be replaced without much overhead since all data access logic is present at a higher level. mmouf@2017
  • 5. Is it an alternative to ADO.NET? • Yes because the developer will not be writing ADO.NET methods and classes for performing data operations. • No because this model is actually written on top of ADO.NET, meaning under this framework, we are still using ADO.NET. mmouf@2017
  • 6. The Entity Framework Architecture Application Entity Framework Entity Data Model (EDM) Describe Object Relational Mapping ADO .NET Provider Data Store ORM Interface mmouf@2017
  • 7. Entity Data Model • The Entity Data Model (EDM) is the foundation of the Entity Framework and is comprised of the three Layers • These three layers allow data to be mapped from a relational database to a more object-oriented business model. • ADO.NET EF 3.5 defines these layers using XML files. These XML files provide a level of abstraction so developers can program against the OO conceptual model instead of the traditional relational data model. mmouf@2017
  • 8. Entity Data Model(Cont.) • The conceptual Layer: Is defined in an XML file using Conceptual Schema Definition Language (CSDL). CSDL defines the entities and the relationships as the application’s business layer knows them. • The Storage (logical) Layer: Which represents the database schema, is defined in an XML file using Store Schema Definition Language (SSDL) • The Mapping Layer: Which is defined using Mapping Schema Language (MSL), maps the other two layers. This mapping is what allows developers to code against the conceptual model and have those instructions mapped into the logical model. mmouf@2017
  • 9. Creating EDM: • From the beginning of EF, you could generate the EDM from an existing Database. • Starting from Visual Studio 2010 and .Net Framework 4.0, there was a significant improvement regarding the creation of EDM. Now we have three ways for creating an EDM: 1)Database First: this is the traditional way by creating the EDM from Existing Database. 2)Model First: Allows you to start with an empty model, define your model and then generate the database, mappings, and classes from the defined model. 3)Code Only: Allows you to use the Entity Framework using Plain Old CLR Objects (POCO) entities and without an EDMX file mmouf@2017