Skip to end of metadata
Go to start of metadata

Gentle.NET lets you work with relational databases without using SQL directly.

See this basic example from the Gentle.NET user guide. I have converted it to boo below.

Object-Relational Mapper

Gentle.NET is an object-relational mapper (ORM). ORMs translate your classes and objects into SQL commands for storing those objects and retrieving them from a relational database.

Contrast that with object-oriented databases that store objects directly without using any SQL (like ZODB in Python). See db4objects and Bamboo Prevalence for examples of using those.

How to Use

Use a relational database engine (be it Firebird, MySQL, MSSQL, etc.) to design your tables (see Database Design), and then create the classes that correspond to those tables.

You can also use the free MyGeneration code generation tool to generate those Gentle.NET classes for you automatically (in C#, which you can then convert to boo using SharpDevelop).

Another Alternative: NHibernate

See the NHibernate page for a recipe using the NHibernate ORM. Being based on an existing Java tool, NHibernate probably has or will have a larger user base than Gentle.NET. But so far I like how Gentle.NET uses [attributes] instead of XML to define the mappings between objects and the database (see the example below, although you still need to create a general XML configuration file with info like the connection string).

Gentle.NET Code Sample

I have been experimenting with using Firebird, MyGeneration, and Gentle.NET with boo. I'll post some examples later.

This sample code has not yet been tested, but is provided for illustration:

Go back to Database Recipes.

  • No labels