LLBLGen Pro- An O/R Mapper Tool
What is O/R Mapper?
O/R Mapper (Object-Relational Mappers) is a programming technique for converting data between incompatible type systems in databases and Object Oriented Programming languages.
It is the general term for the concept of creating mappings between tables / views and their fields, and OO classes and their fields to be able to represent a table or view row in an OO program via a class. O/R Mapping is done using entities and their attributes (which are physically available through table or view definitions) and by creating a class for each entity, mapping each field in that entity class onto a field in a table or view. The management logic necessary to read an entity’s data from the database into an instance of its entity class and back, together with the entity definitions, is called an O/R Mapper framework. Via this framework a developer can manipulate data in the database, using classes and their methods
What does it do?
The generated code from the O/R Mapper handles all of the steps that you would normally have to code yourself, saving you from having to:
- Find the database server.
- Log in and open a connection to the database server.
- Select the particular database containing the information you want.
- Find the correct table.
- Find the correct row.
- Read all the values for that row.
- Convert every type of value from its SQL data type into the .NET data type while checking and handling the possibility of a null value.
- Present those values in a strongly-typed format, so the consumer knows exactly what kind of object to expect (string, integer, array, etc.) and there are no surprises at run-time.
- Create a container to temporarily hold the values while they are being modified.
- Retrieve data from another row in a related table.
- Manage which values have changed and make appropriate INSERT’s, Update’s, and DELETE’s in the appropriate tables in the database to reflect those changes.
- Close the connection.
- LLBLGen Pro will completely auto-generate the data access layer. You do not need to do any hand-coding in this layer
- LLBLGen Pro will optionally generate a business logic layer shell for you to get started with your business layer. You do not have to understand the intricacies of inheritance and making custom classes to take advantage of business logic classes; in LLBLGen Pro these classes are intuitively organized, powerful, and infinitely extendable.
- LLBLGen Pro collections and entity objects are bindable, making them extremely easy to add to .NET controls. This can reduce the size of your UI layer
- Changing the database application and the data access layer without affecting the business logic and UI layers is actually possible with LLBLGen Pro. If you migrate your database schema and stored procedures to a new database application, refrained from using any database-specific features and your schema matched exactly, you could actually re-generate your LLBLGen Pro data access layer and not make any other changes to your application.
- Entities: Every “Row” becomes an “Entity”
- Collections: Every “Table” becomes an “EntityCollection”. Collection classes eliminate the need for DataTable objects and are both strongly typed and bindable.
- Entity relationships: Build into each entity is all relationships in the DB involving that table. You can either get a single entity or an entity collection depending on the type of relationship.
- Typed views: Views in the DB can be wrapped as strongly-typed DataTable. Typed views are read-only; new LLBLGen Pro allows you to add a view from the database as an entity as well as a typed view.
- Typed Lists: Typed lists are the only objects created by LLBLGen Pro that do not correspond one-to-one with DB objects. It’s handy when you need very specific information that does not necessarily correspond to a single table or entity or you only want to grab a subset of information for a given set of table.
- Stored procedures caller classes: Stored procedures that you select will be wrapped in a layer of code. While the parameters of the stored procedures are strongly-typed, the result set is still an untyped-DataSet.
Now what is LLBLGen Pro?
LLBLGen Pro is a complete O/R mapper and data-access tier generator for .NET. It generates a data-access tier and business façade/support tier (in C# or VB.NET), using an existing database schema set.
The generated .NET code is provided as a Visual Studio.NET project that can be added to a solution or compiled separately.
Currently it supports almost every database including Sql Server , Oracle, Firebird/Interbase, PostgreSql, Microsoft Access, IBM DB2 UDB, MySql, Sybase Adaptive Server Enterprise (ASE) and more.
LLBLGen Pro Features
A key feature in LLBLGen Pro is dynamically-generated SQL. When retrieving or manipulating data in a database, the SQL script — the code understood by the database — is generated at run-time based off the requested information and dirty flags in each entity’s fields. This enables a generic save entity function on the Data Access Tier to produce different and optimized SQL code each time it is called, optimizing bandwidth usage and database load.
LLBLGen Pro Objects
References:
http://www.llblgen.com/defaultgeneric.aspx
http://www.llblgen.com/pages/examples.aspx
About the Author
Yash Mittal is part of Software Development & Operations group at OTS. OTS Solutions a company focused in providing Outsourced Software Development and Product Development Services. Yash is a tech guru with immense technical knowledge and master in the domain. With excellent experience, Yash is a great resource in handling complex technical issues and helps OTS in delivering great value to its customers.













