Many software projects aim at reducing cost and an Object Relational Mapping tool is one way to cut down development time and the number of developers required. It helps build the data access layer (thinking in terms of the 3 tier architecture with the system divided into the presentation, business and data access layer).
Hibernate (and NHibernate for Java) have been in the limelight a lot due to their open-source nature. I decided to give a commercial ORM a try, which is how I ended up using LLBLGen Pro. It's a code generator with a couple of proprietary libraries and it simplifies access to the database to the extent that you don't have to write any SQL! Using the generated classes is way more simpler than trying to create a database connection and execute commands on the database - with LLBLGen Pro, everything is a method call, whether it is a table, a view or a stored procedure.
LLBLGen Pro supports two primary templates for code generation - the adapter template and the self-servicing template. The adapter template generates classes that separate the entity classes from the persistence logic, much like a DataSet is separated from the DataAdapter. The self-servicing template generates entity classes that handle their own persistence. The self-servicing classes also handle lazy-loading, which is the ability to retrieve data from the database only when you require it; the adapter classes support what is known as a prefetch path that is used instead of lazy loading and is preferred when working in a disconnected mode.
The use of the ORM can lead to a bit of a performance overhead due to the way the generated classes operate. When it comes down to raw performance, hand-written code performs way better than the ORM generated code.
Monday, May 12, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment