MyGeneration - Open Source C# O/R Mapping
The code generator takes the tables for a wide variety of databases (12!) and produces the class code. It's template driven (not C++ type templates) so the code generator can output code for JScript, VBScript, C# or VB.NET. It's worth a look not just because it's open source but because of the architecture. This is what the C# looks like for accessing an employee record. (This code example is similar to one on the MyGeneration website).
Employees emps = new Employees() ;
if(emps.LoadByPrimaryKey(31))
{
emps.LastName = "Bowman";
emps.Save() ;
}
// Add one new record for Mr Archer
Employees emps = new Employees() ;
emps.AddNew() ;
emps.FirstName = "Mr.";
emps.LastName = "Archer";
emps.Save() ;
// get the last record index
int i = emps.EmployeeID;
Not a sql statement in sight! You'll find mygeneration here and the code on sourceforge. Note, you'll need another sourceforge project- the free 7z archive utility to extract the source code files.


I’m glad to see more people finding the value in MyGeneration (especially since it is free!). There’s a lot more to MyGeneration than dOOdads really, it’s a full code generation suite that enables “rolling your own” OR Mapper as well.