In this series, we will create a ModelGlue:Unity application. Our example application will manage contacts. We will start with a blank canvas and by the end of the series, have a functional application.
Lets begin:
Firstly, you should have the ModelGlue:Unity and Coldspring framework installed. If the framework is not installed, have a look at this post.
Our application will reside in a directory just under the webroot. We will access our application at http://LocalHost/ContactManagerMG. With that in mind, lets open the ModelGlueApplicationTemplate Directory.
This directory serves as an application skeleton for which to begin a new ModelGlue:Unity application.
There are two ways to get a new application up quickly. The first way is to copy the contents of the ModelGlueApplicationTemplate into a new directory just under your webroot called ContactManagerMG. Do a find and replace on ‘modelglueapplicationtemplate’ and change it to ‘ContactManagerMG’.
The second way assumes you have cfeclipse or some other ANT environment. The directions below are specifically for cfeclipse.
Inside the ModelGlueApplicationTemplate directory is a file called build.xml. Build.xml is an ANT script. ANT scripts are sets of commands used to perform file and directory tasks. There are certain parts of the ModelGlueApplicationTemplate that need to be changed to our application name ( ContactManagerMG ).
We will now make the modifications to the build.xml file for the purpose of creating our new application.
Open the build.xml file. On a default install of ModelGlue:Unity the file will look like so:
In plain English, the build.xml file will copy the contents from the ‘source’ directory and place them into the ‘target’ directory then replace each instance of the ‘token’ and replace it with ‘value’.
Make the following changes to the file and then run it.
IIS
Apache
Once your edits are complete, save the file and locate it in the navigator. Right click on the file and choose Run As -> ANT Build. You can see the progress in the console. Assuming no errors, you now have a new ModelGlue application and can begin coding.
Via Find and ReplaceANT build, you now have a new directory called ContactManagerMG. Run this in your browser and you should get a page showing the following:
Model-Glue 2.0: Unity
Model-Glue is up and running!
Voila. A new ModelGlue:Unity application.
In the next series, we will add some functionality to our application.