+ All Categories

LINQ

Date post: 16-Nov-2015
Category:
Upload: tbijle
View: 4 times
Download: 0 times
Share this document with a friend
Description:
zxzXzXZXZZZZZZZZZZZZZZZZZZZZZ
20
Databa se ata access layer Business Layer Client Code
Transcript

Slide 1

DatabaseData access layerBusiness LayerClient Code

SQL Server

DALData access layerBOUIDataset to Business ObjectsTransform User InterfaceBusiness ObjectADO.net object, Dataset. Datareader

Get Data from DALLoop through all rowsSet data from Dataset to the BOAdd to the collection

nameaddress1address2

NameAddress1 as to many relationship100

Data Model transformed to the Object ModelTransformation complication multiplies

DAL Enterprise Application Blocks Custom Data Access Layer Third Party DAL ComponentMatter goes worstEnt 4.1Ent 4.0Ent 3.1Ent 1.1Ent 2.0Ent 3.0

non-uniform mechanismInconsistent DAL componentQuerying and sorting Business object Complex code for object transformationCrud multiplies complicationNeed to write business logic mapping code

Two Problems Inconsistent Data Structure Generalized query mechanism

DataFieldValue

UIBODAL

I understand field and value

I understand field and value

I understand field and value

we all understand field and value

The ClassThe Table

UIBODAL

We all understand entity

Generalized query mechanismCustom Collection ObjectsADO.net ObjectsXMLSomething custom

Business Object ModelTransformation and filling data in the object model

Step 1: - Customer table attributeStep 2: - attribute all fields with column names

SQL Server

DataContextEntityObjects

Common Query Language

Common Shared Entity

UIBODALTableIEnumerableCountryEntity object consistent

BODALLINQ says: - I can help you query and transform DAL to Business object modelsLINQ says: - I can help you ease query and filter Business object collectionLINQ says: - I can be used DAL replacement

UIBODALCountryEntityPure Entity objectIEnumerableTableEntity objects has a Business object context hereEntity objects has a Datacontext here

7 lines of codes reduced to 3 lines of codes

7 lines of codes reduced to 2 lines of codes


Recommended