Guide to Entity Framework with



Download 11,91 Mb.
Pdf ko'rish
bet28/48
Sana30.03.2022
Hajmi11,91 Mb.
#517122
TuriGuide
1   ...   24   25   26   27   28   29   30   31   ...   48
Bog'liq
Entity Framework Tutorial, Second Edition (1)

[
 20 
]
from Employee
INNER JOIN 
Department on Department.DepartmentID = Employee.DepartmentID
INNER JOIN
Salary on Salary.EmployeeID = Employee.EmployeeID
This is how you would use Entity SQL to achieve the same result:
Select FirstName, LastName, DepartmentName, Basic from Employee
In the previous example, 
EmployeeData
is an entity that has been derived from the 
Employee

Department
, and 
Salary
entities.
The Object Services Layer
As well as querying the conceptual model, you might, at some point, have to work 
with entities such as in-memory objects or a collection of in-memory objects. To do 
this, you need Object Services. You can use it to query data from almost any data 
store, and with less code.
You can query data from the EDM by either using Object Services or 
EntityClient. However, if you require change tracking, be aware that only 
Object Services provides this feature. Note that in either case, the ADO.NET 
data providers are responsible for talking to the underlying database.
Note that the Object Services Layer internally uses an 
ObjectQuery
object for query 
processing. To use object services, you should include the 
System.Data.Objects
and 
System.Data.Objects.DataClasses
namespaces.
Here is an example that shows how you can use Object Services to retrieve data:
using (ObjectContext ctx = new ObjectContext("Name=
PayrollEntities"))
{
ObjectQuery data =
ctx.CreateQuery("PayrollEntities.
Employees");
foreach (Employee emp in data)
{
Console.WriteLine(emp.EmployeeID);
}
}


Chapter 1
[
 21 
]
In addition to enabling you to perform 

Download 11,91 Mb.

Do'stlaringiz bilan baham:
1   ...   24   25   26   27   28   29   30   31   ...   48




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish