DAL Business Design

When developing business objects, I tried several different ways to record the level of data access. Some of them work better than others, but I always felt that there should be a "better" way.

I would really like to see the different ways that people deal with DAL in different situations and their opinions on how the technique works or doesn't work.

+5
source share
6 answers

I relied heavily on the Billy McCafferty NHibernate Best Practices article / sample code for many Web / WinForms applications now. This is a remarkably written article that will provide you with a nice simple sample architecture - in addition to teaching you basic NHibernate and TDD. He is trying to give you an overview of his architectural and design decisions.

It creates a very elegant DAL using generic DataAccessObjects, which you can extend for each domain object, and it is very loosely coupled to BL using interfaces and DAOFactory. I would recommend taking a look at BasicSample first, especially if you have not worked with NHibernate before.

Please note that this article is heavily dependent on NHibernate, but I think the general approach can be easily changed to fit other ORMs.

+4

, , " ", , DAL . " " - .

10, " " -.

, , , , , .

, "Row Data Gateway". ( , , CRUD). ORM , .

+2

. " " - :

ORM, llblgen, .

+1

NHibernate ( BTW @Watson ), suvius-flamingo codebetter. , , MVC NHibernate.

suvius-flamingo.

+1

[] , [/update]

Bunian , - ( ) , , .

- , , , itnerfaces. , - Person , IRepositoryForPerson, Injection Dependency, .

:

http://www.emadashi.com/index.php/2008/11/data-access-within-business-objects-bunian-design//

Bunian ( ):

http://www.codeplex.com/Bunian

, , (, NHibernate). , :)

,

+1

, DAL, SQL, . ONe, DAL SQL - ORM. OO . , ORM. , : SQL-. , , , . ORM (, ) , , ( , , ). , API ORM .

ORM , , , , . , , " " , , SQL , " ", SQL , ORM, , , .

This is obviously a more fragile coding approach than if you religiously use ORM, as it was intended, so you should be more diligent in terms of unit testing, SQL injection, and the proper separation of problems. So, to summarize, I agree with Ash, although this does not mean that he / she agrees with me :)

+1
source

All Articles