There are a whole boatload of object/relational mapping tools for .NET out there
today - applications designed to let you work with objects in your code while storing
the underlying data in a relational database, and handling all the messy details
and data access code for you. LLBLGen Pro is one of the most professionally developed
and polished of these. If you start with a decently-designed relational database
(that is, you have some concept of normalization, a reasonable naming convention,
and primary and foreign keys), LLBLGen Pro can quickly generate a solid data access
tier and business logic support tier for your application. All you have to do then
is layer on the top end of your application - the actual business logic and GUI
tiers - and you're ready to go. LLBLGen Pro gives you pretty much all of the functionality
you need as the foundation for your own application-specific code.
One thing you'll find here is flexibility. On the database side, you can choose
from SQL Server (7.0 through 2005, as well as SQL Server CE), Access (2000 through
2003), Oracle (8i through 10g), PostgreSQL, Firebird, DB2, or MySQL. The generated
code can be VB.NET or C#, and you can target .NET 1.0, 1.1, or 2.0, as well as the
1.0 or 2.0 Compact Frameworks. In addition, LLBLGen Pro uses a pluggable code generation
framework that offers you some choices in the code itself. For example, for the
data access classes themselves you have a choice between SelfServicing and Adapter
templates, and it's possible that more templates will be released in the future.
This makes it possible to tune the output somewhat, based on things like whether
you need database independence or whether you expect to extend the framework.
Another highlight of LLBLGen Pro is the help file. There is an excellent section
on concepts that covers O/R mapping, entities, stateless persistence, database drivers,
and other topics, and explains the decisions that underlay the design of the product.
There are debates and differences between various OR/M products on many of these
topics, and the help does a good job of explaining where LLBLGen Pro fits in and
why it uses the patterns that it does. You'll certainly want to read at least this
much of the help before diving in. There is also an incredibly useful and extensive
task-based section with dozens and dozens of examples of using the generated code
- everything from retrieving, updating, and deleting entities to esoterica such
as controlling transactions and optimizing prefetches for various circumstances.
So what does code using LLBLGen Pro look like? It's pretty darned simple. Fetch
a customer by primary key:
CustomerEntity customer = new CustomerEntity("13517");
Modify the data:
customer.Phone = "401-555-1212";
Save the modified data:
customer.Save();
Of course, that is just the first baby step. There is plenty more here, from filling
collections with related entities to fetching subtypes to concurrency control to
support for nullable types and on and on. Very likely the folks over at Solutions
Design have thought of everything that you might throw into your own data access
layer. If you're writing line-of-business applications that host functionality on
top of multiple-table databases, and you find yourself spending a lot of time on
"plumbing" code, you need some product like this to do the routine work for you.
LLBLGen Pro is one of the best that I've tested; it writes good code that's easy
to use, and does it quickly. You can
download a 30-day trial to test it out yourself.