Gentle.NET 1.2.9 review

Download
by rbytes.net on

Gentle.NET is an RDBMS independent object persistence framework

License: LGPL (GNU Lesser General Public License)
File size: 0K
Developer: Morten Mertner
0 stars award from rbytes.net

Gentle.NET is an RDBMS independent object persistence framework. Gentle.NET features automatic SQL generation and object construction, an SQL factory for creating custom queries, DataView construction helpers, excellent performance and reasonably complete docs.

The framework defines a few attributes with which you have to decorate the objects you wish to persist. Decorate classes with the TableName attribute, and members (properties and fields as you see fit) with the TableColumn attribute.

There are additional attributes available which need only be used when no Analyzer class exists for the database you are using (see Database Provider - Implementation Status). The Analyzer classes are used to obtain metadata on the current schema directly from the database, thus bypassing the need for replicating this information in your code.

If no Analyzer exists, primary key columns must be decorated with the PrimaryKey attribute, and foreign keys and their mappings must be declared using the ForeignKey attribute. The TableColumn attribute provides properties allowing you to provide details on type, size and null-handling. If an Analyzer does exist, the information obtained automatically overrides any such setting.

Business objects may optionally inherit from the Persistent class, which provides a set of standard methods for persisting and retrieving objects. You can replicate these on a different base class if needed, or on a manager class if you prefer a more SOA-oriented design. Gentle provides support for identity columns (where the database assigns a primary key value to the row being inserted) to implementors of IPersistent (which includes the Persistent class).

The main access point into the framework functionality is provided by the PersistenceBroker class, which is responsible for orchestrating all access to a given database provider.

The PersistenceBroker is responsible for basic query construction and caching, as well as interaction with the database backends. You can create as many PersistenceBroker instances as needed, such as one for every database to which you need to connect. Various classes permit or require you to pass a PersistenceBroker instance, which will be used subsequently for all database operations performed by the class.

If you need to connect to a single database only, you can use the static Broker class, which delegates all calls to a default PersistenceBroker instance (using the DefaultProvider configured in the configuration file).

Persistent objects are identified by a Key, which is really just a Hashtable with some convenient methods for gathering property values from objects. The Key class knows how to populate itself when given an object instance and a set of property names, and also provides a means of obtaining a key holding just the primary key fields.

This is useful when constructing custom queries as constraints can be passed as Key instances to methods on both the (Persistence)Broker and SqlBuilder classes. This encapsulation also enables Gentle to work with multi-column primary keys.

To execute custom SQL statements use the SqlStatement class. Use the SqlBuilder class to construct instances of this class whenever the statement is for a supported type (i.e. a class decorated with the proper attributes as outlined above).

The SqlBuilder provides a database independent way of constructing queries and has many methods for adding constraints and otherwise customizing the query. It is used internally by the PersistenceBroker whenever it needs to generate statements.

You can declare a DataView layout using the CustomView attribute on the properties to include in the DataView. The actual DataView can be obtained using the ObjectView class by supplying an array of business objects.

Multiple statements can be transacted (grouped) using the Transaction class.

What's New in This Release:
This release features a complete rewrite of the cache subsystem, with significant performance improvements as a result.
There have also been several minor improvements and bugfixes throughout the code base.

Gentle.NET 1.2.9 search tags