Data access application block Vs Tool generated DAL

Hi,

Can somebody throw light upon what are the differences between a data access layer generated by a OR mapping layer generated using a tool (which generates the code for DAL and having all the sql's embedded inside it) and using a data access application block provided by microsoft and when to use what.

My feeling is that DAAB provided only flexiblity of database indepenndence by using factiory methods while tool generated DAL code helps in totally remoing the coding time.

Any other differences ,if somebody can quote, would be of great help

Cheers



Answer this question

Data access application block Vs Tool generated DAL

  • Brian Jimdar

    There is a matter of approach to data - O/R mapping usually implies domain driven design while using data-set based solution don't. A rough guideline I use is to ask myself whether the application is data centric (choose data-sets) or entity-centric. In data centric application you need a lot of cross-entity queries which are not convenient using custom business entities. There are of course many other variables to think about before you decide on an approach.

    Arnon



  • NHK

    The main difference, as you probably noted, is that DAAB doesn't implies a domain model. An ORM implies OBJECTS, and DAAB is only to obtain DATA. You can use DAAB "below" an ORM, but it is not oriented to objects.

    If you program using a domain model, you can use an ORM tool, or a code generator tool that implements the Object Relational Mapping, and in this case, the code can use DAAB, or any code that access the database (yes, new SqlConnection and so on...). My opinion is that we can ever program a domain model in a form that is independent of the underlaying persistence... of course, some persistent technologies are more intrusive that other.... For example, DLinq in some way, implies the use of attributes on your domain model. Or NHibernate implies some care in the relations between objects....

    You can check some tools for generating code that use DAAB:

    http://blogs.msdn.com/rjacobs/archive/2005/05/19/420077.aspx
    http://blogs.msdn.com/tomholl/archive/2006/03/22/558467.aspx
    http://workspaces.gotdotnet.com/datatiergenerator
    http://sourceforge.net/projects/dtg-entlib/

    Angel "Java" Lopez
    http://www.ajlopez.com/


  • Data access application block Vs Tool generated DAL