EntityFrame work and LINQ

adhocjackpotSecurity

Nov 5, 2013 (4 years and 4 days ago)

107 views

EntityFrame

work and LINQ

CH 14

linq


LINQ enables you to query data from a wide
variety of data sources, directly from your
programming code. LINQ is to .NET
programming what SQL is to relational
databases

LINQ

is

an

important

plumbing

technique

in

many

data
-
access

scenarios,

including

database

access

in

ASP
.
NET

web

applications

using

the

ADO
.
NET

Entity

Framework
.


LINQ

is

so

important,

it

has

been

integrated

in

many

different

places

in

.
NET
.

LINQ

is

available

for

objects

enabling

you

to

query

in
-
memory

collections
.

Additionally,

LINQ

is

available

for

XML,

Entities,

ADO
.
NET,

and

DataSets
,

each

type

providing

access

to

a

different

data

store,

but

with

the

same,

unified

querying

language
.

LINQ

is

also

used

as

the

query

language

for

the

ADO
.
NET

Entity

Framework
.

ADO.NET Entity Framework


ADO.NET Entity Framework

(EF) is an object
-
relational mapping (ORM) framework for the
.NET Framework

To

work

with

EF

in

your

ASP
.
NET

web

applications

you

have

a

couple

of

different

options
.

First,you

can

write

queries

in

the

Code

Behind

of

a

page

and

then

bind

the

results

to

a

data
-
bound

control

using

the

DataSource

property

and

DataBind

method

of

the

control
.

Alternatively,

you

can

use

the

EntityDataSource

control

that

serves

as

the

bridge

between

your

data
-
bound

controls

and

your

model
.

Combined

with

the

new

ListView

and

DataPager

controls,

the

EntityDataSource

gives

you

the

ability

to

create

fully

functional

CRUD

pages
.


ADO.NET Entity Framework abstracts the relational
(logical) schema of the data that is stored in a
database and presents its conceptual schema to the
application


At development time, this abstraction
eliminates the object
-
relational impedance
mismatch that is otherwise common in
conventional database
-
oriented programs.
The run
-
time overhead of mapping between
the conceptual schema and the underlying
relational schema is still a factor to be
considered.


in a conventional database
-
oriented system,
entries about a customer and their
information can be stored in a
Customer

table,
their orders in an
Order

table and their
contact information in yet another
Contact

table. The application that deals with this
database must "know" which information is in
which table, i.e., the relational schema of the
data is hard
-
coded into the application.

Object
-
relational impedance
mismatch


The
object
-
relational impedance mismatch

is
a set of conceptual and technical difficulties
that are often encountered when a relational
database management system (RDBMS) is
being used by a program written in an object
-
oriented programming language particularly
when objects or class definitions are mapped
in a straightforward way to database tables or
relational schemata.