Create TimeTracker Application

Now that you have your environment setup you can start using AndroMDA in your projects. This section will guide you through creating the base TimeTracker solution. These are the same steps you would follow when you are starting your own application. Please note the TimeTracker completed sample is available here:

Couple of tips before we start:

  • Please follow the instructions in this tutorial very carefully and precisely. Do not take any shortcuts, as doing so will only waste your time. There is a reason for every step in the tutorial. You will not find any fluff here!
  • It is recommended to use the latest version of FireFox or Internet Explorer to read this tutorial.

Create the Solution

  1. Run Visual Studio 2005
  2. Select File | New Project
  3. Create a new blank solution, found underOther Project Types | Visual Studio Solutions. Name the solutionNorthwind.TimeTracker.
  4. Click Ok

Run the Solution Wizard

  1. Click the Run MDA Solution Wizard and click Next to exit the welcome page.
  2. Accept the default project name of Northwind.TimeTracker click Next.
  3. Accept the default common project name of Northwind.TimeTracker.Common and clickNext.
  4. Accept the default core project name of Northwind.TimeTracker.Core and clickNext.
  5. Accept the default checked Create schema export project option and the default project name of Northwind.TimeTracker.SchemaExport and clickNext.
  6. Check the Configure web project box and accept the default project name ofNorthwind.TimeTracker.Web. Check the Add membership support box and clickNext.
  7. Accept the default web common project name of Northwind.TimeTracker.Web.Common and clickNext.
  8. Verify that your project settings look like the screenshot below, and click Next to run the wizard.
  9. Your solution is now configured for use with AndroMDA. Here is a list of what was created for you:
    • mda directory: AndroMDA configuration files and an empty model. Because we checked membership support basic user and roles entities were added automatically.
    • Northwind.TimeTracker.Web: Web site with nhibernate support
    • Northwind.TimeTracker.Common: Common project. This is where AndroMDA generates value objecst and enumerations
    • Northwind.TimeTracker.Core: Core project. This is where AndroMDA generates entities, nhibernate mappings, services, and data access objects.
    • Northwind.TimeTracker.SchemaExport: A console application that will generate database schema from your model. It can optionally export the schema to a running database.
    • Northwind.TimeTracker.Web.Common: Project for classes and controls the web site will use. Because we checked membership support an ASP.NET 2.0 MembershipProvider that uses the user and role entities was created for us, and the web site is pre-configured to use it.

Open the UML Model

  1. Click the Open Model button to open your project's UML model.
  2. MagicDraw will open and it will automatically load the model that was generated by the add-in. An initial package structure was created by the add-in using the name of the solution you selected. Additionally a User entity and some supporting classes were created and added to the model because the membership support option was selected.

Leave MagicDraw open for now, as we will be adding to the model.

Creating the TimeTracker Database

We need to create a database for TimeTracker to store the timecards. While you can use any type of database NHibernate supports in your project, this tutorial will focus on SQL Server 2000, 2005 and MSDE. Here are the steps to creating a database for TimeTracker:

Creating the Database with SQL Server 2000/2005

  1. Run Enterprise Manager (2000) or SQL Server management Console (2005)
  2. Expand your local server (2000) or connect to your local server (2005)
  3. Right click the Databases folder and select Create new database
  4. Enter the database name NorthwindTimeTracker and click Ok.

Creating the Database with MSDE

  1. Open a console window by clicking Start |Run, typingcmd, and clicking Ok.
  2. Type osql -U sa -P password -S localhost\myinstance with your MSDE login credentials and myinstance changed to your instance name.
  3. Type the following to create a database calledNorthwindTimeTracker:
    1> use master
                            2:> go
                            1> CREATE DATABASE NorthwindTimeTracker
                            2> go
                            The CREATE DATABASE process is allocating 0.63 MB on disk 'NorthwindTimeTracker'.
                            The CREATE DATABASE process is allocating 0.49 MB on disk 'NorthwindTimeTracker_log'.