Category Archives: Mere Mortals Framework

ASP.NET example using Mere Mortals Framework

I was working reproducing the ASP.NET example described in Mere Mortals Framework Developer’s Guide, using Northwind MS SQL database, using VB.NET as implementation language (the guide explains the steps to create this app using VB.NET or C#).

You can download the result from my Skydrive:

Load the solution in VS 2008 (you must have Mere Mortals Fwk DLLs in your machine).

This is the CustomerOrders.aspx page:

The first column is a link, that points to OrderEdit.aspx, where you can edit

You can change the connection string at web.config:

In my current project, the team is working improving the validation process, specially in grid fields. I hope I will rewrite this example as templates and tasks using AjGenesis. Keep tuned!

Angel “Java” Lopez

Code Generation for Mere Mortals Framework

In the current project, my agile team is developing a full health application (Medusa Project), using Mere Mortals Framework as a base to business objects, persistence and WinForm/ASP.NET presentation. You can download a trial version of this framework:

There is a feature list at

You can download the developer Guide from

MM .NET Developer’s Guide

The framework were developed by Kevin McNeish, Microsoft MVP, president and Chief Architect of Oak Leaf Enterprise. The framework supports typed entities, but in the background, it’s based on datasets. You can generate a business objects project from templates, and with a code generator provided by the product, you can populate that library with classes, derived from a database.

In my team, we are feeding metadata reading database information, and then, we are generating a full ASP.NET Web Application, a business object libraries, stored procedures, and DDLs for database regeneration. All using AjGenesis, my open source code generation utility. I should post about the experience. The seed task and templates, were derived from the example:

AjGenesis- Generating the model from the database

In this post, I describe another approach: starting from an abstract model, I’m generating:

– Scripts for creating the database
– Business Objects a la Mere Mortals class library
– WinForm project with maintenance forms

I posted about generating applications from an abstract model at:

Application Generation using AjGenesis

but caveat: AjGenesis is based in a free model. You can model what you want. The trivial example:

Code Generation with AjGenesis- A Hello World application

The model

You can download the example from the Codeplex project site example page:

It contains:

The model resides in Projects/AjFirstExample/Project.xml



    <Description>First Example using AjGenesis</Description>






            <Entity Source="Entities/Customer.xml"/>

            <Entity Source="Entities/Supplier.xml"/>



            <List Entity="Customer"/>

            <List Entity="Supplier"/>



            <Form Entity="Customer"/>

            <Form Entity="Supplier"/>



            <View Entity="Customer"/>

            <View Entity="Supplier"/>




There are two entities, Customer and Supplier. The Customer entity:



    <Description>Customer Entity</Description>

































There is a technology dependent model at Projects/AjFirstExample/Technologies/VbNet3.xml:











You can change the host to .\SQLEXPRESS if you don’t have a running MS SQL Server. You can add <Username> and <Password> if you are using SQL security. If there are not present, the code uses integrated security.

Generating the application

You must download AjGenesis current release 0.5 from Add the bin directory to your path. Then, run from the example directory:

GenerateProject.cmd AjFirstExample VbNet3

The first parameter is the project name, and the second is the technology to use. The command invokes

AjGenesis.Console Projects\%Project%\Project.xml tasks\BuildProject.ajg  Projects\%Project%\Technologies\%Technology%.xml tasks\BuildTechnology.ajg tasks\BuildProg.ajg tasks\BuildSql.ajg

It loads the project model, execute the BuildProject task, then loads the technology model, executes the BuildTechnology tasks. The task BuildProg generates the code, and BuildSql generates the DDL to create the database.

It creates a new folder, Build, containing

In Sql folder, you find the ExecuteAll.cmd to create the database

You can run it with a parameter, specifiying your server:

ExecuteAll.cmd Bombadil

If you run this command without a parameter, it uses the host specified in the technology model. There is a VS 2008 solution with two projects, in Src folder:

You can load and compile in Visual Studio (you must have Mere Mortals Fwk installed).

The class library project contains Mere Mortal business objects definition (using partial classes, data access calling stored procedures, rules)

The Win form project has two maintenance forms, for Customers and Suppliers:

Well, it’s not the “killer application” but it’s running:

You can download the generated solution, from my Skydrive


Using an abstract model, we can generate the usual text artifacts required by Mere Mortals fwk (or any other framework, technology). With partial classes and separated files, we can regenerate the code from the model, without losing our manual code. We can augment the generated code with automatic validation, rules, and any coding standard we were using.

But the main point, for me, it’s that using an abstract model, we are separating the important core from the technicalities. I could regenerate the application with other base framework, other languages, but our model could be the same. The model describes what we want. Tasks and templates compose an expert system, that knows HOW to get what we want as application.

Angel “Java” Lopez