Guide to Entity Framework with


A comparative analysis of Entity



Download 11,91 Mb.
Pdf ko'rish
bet19/48
Sana30.03.2022
Hajmi11,91 Mb.
#517122
TuriGuide
1   ...   15   16   17   18   19   20   21   22   ...   48
Bog'liq
Entity Framework Tutorial, Second Edition (1)

A comparative analysis of Entity 
Framework and other ORM tools
Data access strategies have changed over the years. From 
Remote Data Objects
(
RDO
), 
Data Access Objects
(
DAO
), to ADO.NET, the industry has seen a
marked improvement in the way data is accessed these days.
ORM tools enable you to access data from persistent storage devices without 
having to bother about how the underlying data is actually stored. NHibernate is 
a lightweight ORM tool for .NET. It has a statically compiled counterpart called 
Fluent NHibernate. Fluent NHibernate provides you with an XML-less, compile safe, 
automated NHibernate mapper with LINQ support. Domain modeling is an area 
where Entity Framework scores over NHibernate.


Introducing the ADO.NET Entity Framework
[
 8 
]
Consider the following entity class:
public class User
{
public virtual Int32 UserID { get; set; }
public virtual String UserName { get; set; }
public virtual String CreatedBy { get; set; }
public virtual DateTime CreatedDate { get; set; }
public virtual String ModifiedBy { get; set; }
public virtual DateTime ModifiedDate { get; set; }
}
Downloading the example code
You can download the example code files from your account at 
http://www.packtpub.com
for all the Packt Publishing books you 
have purchased. If you purchased this book elsewhere, you can visit 
http://www.packtpub.com/support
 and register to have the files 
e-mailed directly to you.
The following class illustrates how you can create a mapping for the preceding class 
by extending the generic 
ClassMap
class:
public class UserMap : ClassMap
{
public UserMap()
{
Table("Users");
Id(x => x.UserID).GeneratedBy.Identity();
Map(x => x.UserName);
Map(x => x.CreatedBy);
Map(x => x.CreatedDate);
Map(x => x.ModifiedBy);
Map(x => x.ModifiedDate);
}
}
The following code example illustrates how you can create a data gateway for the 
User
entity class:
using FluentNHibernate;
using NHibernate;
using FluentNHibernate.Cfg.Db;
using FluentNHibernate.Automapping;
using NHibernate.Cfg;


Chapter 1

Download 11,91 Mb.

Do'stlaringiz bilan baham:
1   ...   15   16   17   18   19   20   21   22   ...   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