Writing /home/infogasy/domains/wiki.infogasy.net/public_html/data/cache/8/8a8c0fd0f406c343e0c29208f62da20a.xhtml failed

Araka ny lesona farany DAL (Data Access Layer) dia hita fa misy lesoka ny fifandraisana amin’ny DataBase miaraka amin’ny D4Modelizer. Noho izany dia hofafantsika daholo ireo kirakira manao CRUD ka ireo Business Entities ihany no hotazomintsika.

Nanamoboka nanamboatra Framework DAL ary izahay eto amin’ny infogasy, toy izao ny sombiny amin’izany.

:ifgdokuwiki:dalsqlserver02.jpg

Io izany no hanaoloantsika an’ilay CRUD an’ny D4Modelizer, mbola tsy tena tonga lafatra tanteraka izy io, fa hatsaraina tsikelikely. ny SqlHelper dia nalaina tamin’ny Application Blocks an’i Microsoft izay manamora ny fiantsoana Stored Procedure sy DML (Data Manipulation Language).

MappingHelper kosa dia kilasy iray mikarakara ny fampifandraisana vaovao iray hifanarana amin’ny Business Entities. Izay hitanao eto amin’ny sary ambany ny atiny. :mappinghelper.jpg

Mampiasa Reflection izy izao, izany hoe mamaky ireo kilasy avy aty ivelany.

Fanazavana tsotsotra momba an’ilay DALSQLSERVER: Marihana aloha fa tsy mbola misy resaka arsitektiora telo andalana ity hataontsika ity fa manazava tsotsotra amin’ny fomba fohy ny fanamboarana DAL (Data Access Layer).

Ny Table izany dia tsy niova fa ireo efa hitanareo tamin’ny sary teo aloha, fa ny Stored Procedure kosa dia namboarin’ny tamin’ny Wizard - Enteprise Manager. Raha ny fitadidiko dia ny 2000 ihany no manana an’io Wizard io.

:ifgdokuwiki:ps.jpg

Raha dinihinareo dia mahazo anarana ho azy ireo Sproc rehefa voaforana miaraka amin’ny wizard, ka izay zavatra izao no nohararaotina nampiasaina tao anatin’ilay DALSQLSERVER. Jereo ohatra inty:

int ret = SqlHelper.ExecuteNonQuery(strConn, “insert_” + classeName + “_1”, param);

satria ny classeName ny antsika dia mitovy amin’ny anaran’ilay Table, noho izany afaka manao toa an’io ambony io isika. ny strConn no manondro ny toerana misy ny DataBase.

Raha ohatra izany ka IFG_FKB_MPIKAMBANA no anaran’ny Table antsika, dia insert_IFG_FKB_MPIKAMBANA_1 no anaran’ilay Sproc hampiasaina amin’ny fanamboarana.

Raha izay ary ny eo amin’ny resaka DAL, dia andeha hatao topimaso ny mety ho hita ao amin’ny BLL (Busness Logic Layer)

:ifgdokuwiki:businessfactory03.jpg

Raha hampiharina izany ireo zavatra rehetra ireo dia ny BusinessFactory sy ny Model ihany no tena hampiasaintsika,oty izao hasehon’ny ohatra eto ambany izao:

:ifgdokuwiki:winform.jpg

Raha hasiana tsidika kely ny resaka arsitektiora dia mba ahafahana miovaova DataBase, dia afaka mampiasa Pattern Abstract Factory isika, mamorona IDAL (Interface DAL) isika, izay manjanaka ny DALSQLSERVER,DALORACLE,DALMYSQL,sns.... Ary ny ao anatin’ilay BusinessFactory antsika dia hampiarantsika ny IoC (Inversion Of Control), izany hoe mamorona Property IDAL isika, dia arakarakan’ny voasoritra ao anaty Configuration File antsika no hisafidianany hoe DAL Mysql,Oracle,SqlServer ve no hampiasaina.

Fanamarihana kely momba an’ilay fijery hoe Table = Class, dia natao ho an’ny laminasa kely, na antonontonony, fa raha laminasa goavana dia fomba fijery hafa izay haseho anao amin’ny lesona manaraka, na koa mampiasa NHibernate na izay mitovitovy aminy

Tsetsatsetsa tsy aritra fotsiny ireo fa mbola azavaina amin’ny lesona manaraka rehefa manolotra arsitektiora maro andalana amin’ny resaka DAL.

Izay indray ary no azo natolotra anao anio,dia amin’ny manaraka indray

Azonao alaina eto ireo laminasa. Marihana fa mbola tsy feno izy io, fa efa azonao hangalana hevitra.

* IFG.FRAMEWORK.DAL

CRUD:Create, retrieve, update and delete

Sproc: Stored Procedure (Procedure Stockée)

 

ifgframeworkdal0.1.txt · Novaina farany:: 2008/09/11 12:43