SlideShare a Scribd company logo
1 of 16
ADO. Net Entity Framework
Prepared byPrepared by
Girish GowdaGirish Gowda
Introduction to EF
 Creating a database can be difficult .
 A database models information in the real
world using a collection of tables, indexes,
views, and other items. In other words, a
database is an abstraction of the real-world
information that it’s supposed to represent.
 the Entity Framework relies on a graphical
presentation of the data so that the
developer can literally see the relationships
between the various tables and other
database items.
Continue…
 The Entity Framework provides the means to
create various kinds of models that a
developer can interact with in a number of
ways. As with the architect’s model, the
Entity Framework uses a graphical interface
to make information about the underlying
database structure easier to understand and
modify.
 The Entity Framework is actually a Microsoft
ActiveX Data Object .NET (ADO.NET)
technology extension.
Understanding the Entity Framework
elements
 The Entity Framework relies on XML files to
perform its work.
 These files perform three tasks: defining the
conceptual model, defining the storage
model, and creating mappings between the
models and the physical database.
CONT….
 conceptual model :-Entity Framework that
developers interact with most. This model
defines how the database looks from the
application’s perspective .
 storage model :-This model is often called the
logical model because it provides a logical
view of the database that ultimately
translates into the physical database .
 model mappings :-In order to make the two
models work together, the Entity Framework
requires model mapping—a third element
that describes how something in the
conceptual model translates to the storage
model, and vice versa.
Introducing the Entity Framework files
 Viewing the Conceptual Schema Definition
Language file
The Conceptual Schema Definition
Language (.CSDL) file contains the XML
required to build the conceptual model of the
database content as viewed by the
application. Eg..
<!-- CSDL content -->
<edmx:ConceptualModels> <Schema
xmlns="http://schemas.microsoft.com/ado/
2009/11/edm"...> <EntityContainer
Name="Model1Container"
annotation:LazyLoadingEnabled="true">
<EntitySet Name="Customers"
EntityType="Model1.Customer" />
 Viewing the Store Schema Definition
Language file
The .SSDL file contains the XML required to
define the storage model of the database
content as viewed by the database manager.
<!-- SSDL content -->
<edmx:StorageModels>
<Schema Namespace="eprescription.Store"
Alias="Self"
Provider="System.Data.SqlClient”
 Viewing the Mapping Specification Language
file
The .MSL file creates a relationship
between the .CSDL and .SSDL files. The
mapping serves to define how the application
view and the database manager view reflect
the same database, but from differing
perspectives. For example, the model
mapping defines which conceptual model
property translates into a particular storage
model property.
CONT..
 <!-- C-S mapping content -->
<edmx:Mappings> <Mapping Space="C-S"
xmlns="http://schemas.microsoft.com/ado/
2009/11/mapping/cs">
<EntityContainerMapping
StorageEntityContainer="Model1StoreContai
ner"
CdmEntityContainer="Model1Container">
<EntitySetMapping Name="Customers">
<EntityTypeMapping
TypeName="IsTypeOf(Model1.Customer)">

C:UsersCherryDesktopXML file of edmx.docx
Entity Client – EDM, Entity SQLEntity Client – EDM, Entity SQL
Entity FrameworkEntity Framework
RuntimeRuntime
Data Providers (ADO.NET patterns)Data Providers (ADO.NET patterns)
SQL ServerSQL Server RelationalRelational
DBMSDBMS
Web ServiceWeb Service
DomainModelingDomainModeling
ToolsTools
ModelingModelingMappingMapping
BrowsingBrowsing
BindingBinding Programming LayersProgramming Layers
CodeGenCodeGenCodeGenCodeGen
ReportingReportingReportingReporting
SyncSyncSyncSync
AnalysisAnalysisAnalysisAnalysis
SearchSearchSearchSearch
Entity ServicesEntity Services
MappingMappingMappingMapping
Query andQuery and
UpdateUpdate
PipelinesPipelines
Query andQuery and
UpdateUpdate
PipelinesPipelines
TransactionsTransactionsTransactionsTransactions
MetadataMetadata
ServicesServices
MetadataMetadata
ServicesServices
Linq to EntitiesLinq to Entities
Entity SQLEntity SQL
Linq to EntitiesLinq to Entities
Entity SQLEntity SQL
ApplicationsApplicationsApplicationsApplications
SqlClieSqlClie
ntnt
SqlClieSqlClie
ntnt
OtherCliOtherCli
entent
OtherCliOtherCli
entent
Non-Non-
relationalrelational
Non-Non-
relationalrelational
Architecture
Entity Framework lets you interact with the
database using one of three techniques
1. Database first : The Entity Framework
creates classes that reflect an existing
database design.
2. Design first : You define a model of the
database that the Entity Framework then
creates on the database server.
3. Code first : You create an application, and
the Entity Framework defines a model that it
then uses to create the database on the
database server.
the role of lambda expressions
 A lambda expression is an anonymous
function (one that doesn’t have a specific
name) that you use to create delegates or
expression trees. The goal behind a lambda
expression is to simplify the task of
expressing abstractions within an
application.
 The lambda expression uses the lambda
operator, =>
 var dbQuery =
UserFavoritesContext.UserFavorites.Where(id
=> id.UserId >= 0).ToArray();
LINQ to Entities
 LINQ to Entities:- you rely on a new provider
named EntityClient.
 LINQ to Entities transforms your query into
EntityClient objects and method calls.
 The EntityClient provider then creates an
interface between the LINQ to Entities
queries and the underlying Microsoft
ADO.NET providers through the various
layers of the Entity Framework.
Several advantages
 Provides dedicated functionality for CRUD
operation (Create, Read, Update, Delete). Easy to
implement CRUD operations.
 If you want to replace the data store, it is very
easy to replace without modifying the data access
logic since all data access logic are present in
higher level.
 Easy to manage one to one, one to many and
many to many relationship between tables.
 Conceptual model can be represented in a better
way.
 Developer can reduce the code in classes and sub-
classes for data access.
Thank You
Cherry Umbrella
Life will be cherry

More Related Content

What's hot

Apply hibernate to model and persist associations mappings in document versio...
Apply hibernate to model and persist associations mappings in document versio...Apply hibernate to model and persist associations mappings in document versio...
Apply hibernate to model and persist associations mappings in document versio...csandit
 
Oracle advanced queuing
Oracle advanced queuingOracle advanced queuing
Oracle advanced queuingGurpreet singh
 
Microsoft access 2007
Microsoft access 2007Microsoft access 2007
Microsoft access 2007JaiRane007
 
Microsoft access
Microsoft accessMicrosoft access
Microsoft accessbabyparul
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0Korhan Bircan
 
MS SQL SERVER: Data mining concepts and dmx
MS SQL SERVER: Data mining concepts and dmxMS SQL SERVER: Data mining concepts and dmx
MS SQL SERVER: Data mining concepts and dmxDataminingTools Inc
 
01 Persistence And Orm
01 Persistence And Orm01 Persistence And Orm
01 Persistence And OrmRanjan Kumar
 
MS SQL SERVER: SSIS and data mining
MS SQL SERVER: SSIS and data miningMS SQL SERVER: SSIS and data mining
MS SQL SERVER: SSIS and data miningDataminingTools Inc
 
Advanced Core Data
Advanced Core DataAdvanced Core Data
Advanced Core DataMake School
 
MS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolsMS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolsDataminingTools Inc
 

What's hot (18)

Apply hibernate to model and persist associations mappings in document versio...
Apply hibernate to model and persist associations mappings in document versio...Apply hibernate to model and persist associations mappings in document versio...
Apply hibernate to model and persist associations mappings in document versio...
 
Bo df b_layer
Bo df b_layerBo df b_layer
Bo df b_layer
 
Project seminar
Project seminarProject seminar
Project seminar
 
Oracle advanced queuing
Oracle advanced queuingOracle advanced queuing
Oracle advanced queuing
 
Services ax2012
Services ax2012Services ax2012
Services ax2012
 
Core Data
Core DataCore Data
Core Data
 
Microsoft access 2007
Microsoft access 2007Microsoft access 2007
Microsoft access 2007
 
Microsoft access
Microsoft accessMicrosoft access
Microsoft access
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0
 
MS SQL SERVER: Data mining concepts and dmx
MS SQL SERVER: Data mining concepts and dmxMS SQL SERVER: Data mining concepts and dmx
MS SQL SERVER: Data mining concepts and dmx
 
01 Persistence And Orm
01 Persistence And Orm01 Persistence And Orm
01 Persistence And Orm
 
MS SQL SERVER: SSIS and data mining
MS SQL SERVER: SSIS and data miningMS SQL SERVER: SSIS and data mining
MS SQL SERVER: SSIS and data mining
 
Ms access
Ms accessMs access
Ms access
 
Advanced Core Data
Advanced Core DataAdvanced Core Data
Advanced Core Data
 
Ax
AxAx
Ax
 
MS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining toolsMS SQL SERVER: Using the data mining tools
MS SQL SERVER: Using the data mining tools
 
Visual basic databases
Visual basic databasesVisual basic databases
Visual basic databases
 
gupea_2077_38605_1
gupea_2077_38605_1gupea_2077_38605_1
gupea_2077_38605_1
 

Viewers also liked

The Shining Dialogue activity
The Shining Dialogue activityThe Shining Dialogue activity
The Shining Dialogue activityailishen
 
Pixlr.com Website Tutorial
Pixlr.com Website TutorialPixlr.com Website Tutorial
Pixlr.com Website TutorialJasmine Ancheta
 
Animoto Website Tutorial
Animoto Website TutorialAnimoto Website Tutorial
Animoto Website TutorialJasmine Ancheta
 
Shampoo products
Shampoo productsShampoo products
Shampoo productswildlife 13
 
4shared.com Website Tutorial
4shared.com Website Tutorial4shared.com Website Tutorial
4shared.com Website TutorialJasmine Ancheta
 
Ireland - symbols, culture and language
Ireland - symbols, culture and languageIreland - symbols, culture and language
Ireland - symbols, culture and languageailishen
 
Powtoon.com Website Tutorial
Powtoon.com Website TutorialPowtoon.com Website Tutorial
Powtoon.com Website TutorialJasmine Ancheta
 

Viewers also liked (10)

The Shining Dialogue activity
The Shining Dialogue activityThe Shining Dialogue activity
The Shining Dialogue activity
 
Airmax bambas
Airmax bambasAirmax bambas
Airmax bambas
 
Industry
IndustryIndustry
Industry
 
Pixlr.com Website Tutorial
Pixlr.com Website TutorialPixlr.com Website Tutorial
Pixlr.com Website Tutorial
 
Animoto Website Tutorial
Animoto Website TutorialAnimoto Website Tutorial
Animoto Website Tutorial
 
Shampoo products
Shampoo productsShampoo products
Shampoo products
 
4shared.com Website Tutorial
4shared.com Website Tutorial4shared.com Website Tutorial
4shared.com Website Tutorial
 
IFTTT Website Tutorial
IFTTT Website TutorialIFTTT Website Tutorial
IFTTT Website Tutorial
 
Ireland - symbols, culture and language
Ireland - symbols, culture and languageIreland - symbols, culture and language
Ireland - symbols, culture and language
 
Powtoon.com Website Tutorial
Powtoon.com Website TutorialPowtoon.com Website Tutorial
Powtoon.com Website Tutorial
 

Similar to Entity framework1

Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkAkhil Mittal
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework OverviewEyal Vardi
 
Microsoft Entity Framework
Microsoft Entity FrameworkMicrosoft Entity Framework
Microsoft Entity FrameworkMahmoud Tolba
 
.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQAvijit Shaw
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)David McCarter
 
Building N Tier Applications With Entity Framework Services 2010
Building N Tier Applications With Entity Framework Services 2010Building N Tier Applications With Entity Framework Services 2010
Building N Tier Applications With Entity Framework Services 2010David McCarter
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)David McCarter
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts frameworks4al_com
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Rich Helton
 
Architecture Specification - Visual Modeling Tool
Architecture Specification - Visual Modeling ToolArchitecture Specification - Visual Modeling Tool
Architecture Specification - Visual Modeling ToolAdriaan Venter
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#Michael Heron
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaSonu Vishwakarma
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Bill Buchan
 

Similar to Entity framework1 (20)

Learning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFrameworkLearning MVC Part 3 Creating MVC Application with EntityFramework
Learning MVC Part 3 Creating MVC Application with EntityFramework
 
Entity Framework
Entity FrameworkEntity Framework
Entity Framework
 
Entity Framework Overview
Entity Framework OverviewEntity Framework Overview
Entity Framework Overview
 
Microsoft Entity Framework
Microsoft Entity FrameworkMicrosoft Entity Framework
Microsoft Entity Framework
 
.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ.NET,ASP .NET, Angular Js,LinQ
.NET,ASP .NET, Angular Js,LinQ
 
unit 3.docx
unit 3.docxunit 3.docx
unit 3.docx
 
Ef code first
Ef code firstEf code first
Ef code first
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 
Building N Tier Applications With Entity Framework Services 2010
Building N Tier Applications With Entity Framework Services 2010Building N Tier Applications With Entity Framework Services 2010
Building N Tier Applications With Entity Framework Services 2010
 
Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)Building nTier Applications with Entity Framework Services (Part 1)
Building nTier Applications with Entity Framework Services (Part 1)
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4
 
Architecture Specification - Visual Modeling Tool
Architecture Specification - Visual Modeling ToolArchitecture Specification - Visual Modeling Tool
Architecture Specification - Visual Modeling Tool
 
PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#PATTERNS07 - Data Representation in C#
PATTERNS07 - Data Representation in C#
 
Entity framework
Entity frameworkEntity framework
Entity framework
 
Synopsis
SynopsisSynopsis
Synopsis
 
Databases
DatabasesDatabases
Databases
 
Databases
DatabasesDatabases
Databases
 
ADO .NET by Sonu Vishwakarma
ADO .NET by Sonu VishwakarmaADO .NET by Sonu Vishwakarma
ADO .NET by Sonu Vishwakarma
 
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
Lotusphere 2007 AD507 Leveraging the Power of Object Oriented Programming in ...
 

Recently uploaded

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Entity framework1

  • 1. ADO. Net Entity Framework Prepared byPrepared by Girish GowdaGirish Gowda
  • 2. Introduction to EF  Creating a database can be difficult .  A database models information in the real world using a collection of tables, indexes, views, and other items. In other words, a database is an abstraction of the real-world information that it’s supposed to represent.  the Entity Framework relies on a graphical presentation of the data so that the developer can literally see the relationships between the various tables and other database items.
  • 3. Continue…  The Entity Framework provides the means to create various kinds of models that a developer can interact with in a number of ways. As with the architect’s model, the Entity Framework uses a graphical interface to make information about the underlying database structure easier to understand and modify.  The Entity Framework is actually a Microsoft ActiveX Data Object .NET (ADO.NET) technology extension.
  • 4. Understanding the Entity Framework elements  The Entity Framework relies on XML files to perform its work.  These files perform three tasks: defining the conceptual model, defining the storage model, and creating mappings between the models and the physical database.
  • 5. CONT….  conceptual model :-Entity Framework that developers interact with most. This model defines how the database looks from the application’s perspective .  storage model :-This model is often called the logical model because it provides a logical view of the database that ultimately translates into the physical database .  model mappings :-In order to make the two models work together, the Entity Framework requires model mapping—a third element that describes how something in the conceptual model translates to the storage model, and vice versa.
  • 6. Introducing the Entity Framework files  Viewing the Conceptual Schema Definition Language file The Conceptual Schema Definition Language (.CSDL) file contains the XML required to build the conceptual model of the database content as viewed by the application. Eg.. <!-- CSDL content --> <edmx:ConceptualModels> <Schema xmlns="http://schemas.microsoft.com/ado/ 2009/11/edm"...> <EntityContainer Name="Model1Container" annotation:LazyLoadingEnabled="true"> <EntitySet Name="Customers" EntityType="Model1.Customer" />
  • 7.  Viewing the Store Schema Definition Language file The .SSDL file contains the XML required to define the storage model of the database content as viewed by the database manager. <!-- SSDL content --> <edmx:StorageModels> <Schema Namespace="eprescription.Store" Alias="Self" Provider="System.Data.SqlClient”
  • 8.  Viewing the Mapping Specification Language file The .MSL file creates a relationship between the .CSDL and .SSDL files. The mapping serves to define how the application view and the database manager view reflect the same database, but from differing perspectives. For example, the model mapping defines which conceptual model property translates into a particular storage model property.
  • 9. CONT..  <!-- C-S mapping content --> <edmx:Mappings> <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/ 2009/11/mapping/cs"> <EntityContainerMapping StorageEntityContainer="Model1StoreContai ner" CdmEntityContainer="Model1Container"> <EntitySetMapping Name="Customers"> <EntityTypeMapping TypeName="IsTypeOf(Model1.Customer)">  C:UsersCherryDesktopXML file of edmx.docx
  • 10. Entity Client – EDM, Entity SQLEntity Client – EDM, Entity SQL Entity FrameworkEntity Framework RuntimeRuntime Data Providers (ADO.NET patterns)Data Providers (ADO.NET patterns) SQL ServerSQL Server RelationalRelational DBMSDBMS Web ServiceWeb Service DomainModelingDomainModeling ToolsTools ModelingModelingMappingMapping BrowsingBrowsing BindingBinding Programming LayersProgramming Layers CodeGenCodeGenCodeGenCodeGen ReportingReportingReportingReporting SyncSyncSyncSync AnalysisAnalysisAnalysisAnalysis SearchSearchSearchSearch Entity ServicesEntity Services MappingMappingMappingMapping Query andQuery and UpdateUpdate PipelinesPipelines Query andQuery and UpdateUpdate PipelinesPipelines TransactionsTransactionsTransactionsTransactions MetadataMetadata ServicesServices MetadataMetadata ServicesServices Linq to EntitiesLinq to Entities Entity SQLEntity SQL Linq to EntitiesLinq to Entities Entity SQLEntity SQL ApplicationsApplicationsApplicationsApplications SqlClieSqlClie ntnt SqlClieSqlClie ntnt OtherCliOtherCli entent OtherCliOtherCli entent Non-Non- relationalrelational Non-Non- relationalrelational Architecture
  • 11. Entity Framework lets you interact with the database using one of three techniques 1. Database first : The Entity Framework creates classes that reflect an existing database design. 2. Design first : You define a model of the database that the Entity Framework then creates on the database server. 3. Code first : You create an application, and the Entity Framework defines a model that it then uses to create the database on the database server.
  • 12. the role of lambda expressions  A lambda expression is an anonymous function (one that doesn’t have a specific name) that you use to create delegates or expression trees. The goal behind a lambda expression is to simplify the task of expressing abstractions within an application.  The lambda expression uses the lambda operator, =>  var dbQuery = UserFavoritesContext.UserFavorites.Where(id => id.UserId >= 0).ToArray();
  • 13. LINQ to Entities  LINQ to Entities:- you rely on a new provider named EntityClient.  LINQ to Entities transforms your query into EntityClient objects and method calls.  The EntityClient provider then creates an interface between the LINQ to Entities queries and the underlying Microsoft ADO.NET providers through the various layers of the Entity Framework.
  • 14.
  • 15. Several advantages  Provides dedicated functionality for CRUD operation (Create, Read, Update, Delete). Easy to implement CRUD operations.  If you want to replace the data store, it is very easy to replace without modifying the data access logic since all data access logic are present in higher level.  Easy to manage one to one, one to many and many to many relationship between tables.  Conceptual model can be represented in a better way.  Developer can reduce the code in classes and sub- classes for data access.