Guide to Entity Framework with



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

[
 19 
]
cmd.Parameters.AddWithValue("FirstName", 
"Joydip");
cmd.Parameters.AddWithValue("LastName", 
"Kanjilal");
cmd.Parameters.AddWithValue("Address", 
"Hyderabad");
cmd.Parameters.AddWithValue("DepartmentID", 
4);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
To query data from the EDM, you have three choices—Entity 
SQL, LINQ to Entities, and Object Services.
Avoiding complex joins
You can use Entity SQL
to avoid complex joins as you will typically be querying 
against a conceptual model of the data. As an example, if we want to display 
employee names and the department names in which they work, we would have to 
join the information of the 
Employee
and the 
Department
tables and then filter the 
unwanted columns to retrieve only the information that is required. Such traversals 
become a nightmare as you add additional tables and therefore require more 
complex joins.
When you implement your Object Model using object-oriented programming 
languages, you expose the object's relationships to other objects of its kind using 
properties. This is in contrast to the approach we just discussed. Hence, designing 
an Object Model using this approach is cumbersome. This is exactly where Entity 
Framework fits in; it represents the conceptual and logical model of data while 
using grammar that is common to both.
Here is a code snippet that explains how you can use Entity SQL to avoid complex 
joins in your application's code. The following T-SQL query can be used to retrieve 
employee data split across three tables, namely, 
Employee

Department
, and 
Salary
:
Select Employee.FirstName, Employee.LastName,
Department.DepartmentName, Salary.Basic


Introducing the ADO.NET Entity Framework

Download 11,91 Mb.

Do'stlaringiz bilan baham:
1   ...   23   24   25   26   27   28   29   30   ...   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