The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Intro to MyGeneration Projects using EntitySpaces

Last post 10-22-2007, 6:15 PM by ESAdmin. 0 replies.
Sort Posts: Previous Next
  •  10-22-2007, 6:15 PM 5971

    Intro to MyGeneration Projects using EntitySpaces

    Introduction to MyGeneration Projects using EntitySpaces

    Overview

    This tutorial assumes that you are already familiar with the "Getting Started" PDF, have at least a basic understanding of using EntitySpaces business objects, and have started working on your own solutions that take advantage of EntitySpaces capabilities. You have reached a point where you are growing tired of having to select the same options over and over again every time you regenerate for database schema changes or EntitySpaces updates.

    One solution to avoiding this repetition is to use MyGeneration Projects. This tutorial will walk you through setting up a basic project using SQL Server's Northwind database. We are going to pretend that we have Demo solution setup in Visual Studio. Our ultimate objective is to be able to open a project in MyGeneration, and, with one click of a button, completely regenerate all the necessary Northwind classes, directly into our solution's "Generated" folder.

    Creating the Project

    • Open MyGeneration.
    • Edit -> Default Settings.
    • Make sure you have a valid connection to your database (in this case SQL Server Northwind), and click OK.

    MyGen Settings

    • File -> New -> Project.
    • Right-click the root Module (New Project).

    New Project

    • Click Edit.
    • Enter a Name (Demo) and Description.

    Rename Module

    • Click OK.

    Adding a Module

    • Right-click the root Module (Demo).
    • Click Add Module.
    • Enter a Name (SQL Server) and Description.

    SQL Module

    • Click OK.
    • Right-click the SQL Server Module.
    • Click Cache Default Settings.

    Adding Template Instances

    • Right-click the SQL Server Module.
    • Click Add template instance.
    • Enter a Name (Tables).
    • Select the template (Generated Classes Master C#).
    • Click Record Template Input.

    SQL Template

    • Enter the Basic Information as you normally would. Be sure the Output location is the "Generated" folder for your solution.

    SQL Basic

    • Click the Advanced Options tab.
    • Set the Options you want.
    • Click OK. (The template will not run, just record input.)

    SQL Advanced

    • Click OK on the Template Instance screen.
    • Right-click the SQL Server Module. (We are going to follow the same steps for our View.)
    • Click Add template instance.
    • Enter a Name (Views).
    • Select the template (Generated Classes Master C#).
    • Click Record Template Input.
    • Enter the Basic Information as you normally would, except select the Views dropdown and choose your views. Be sure the Output location is the "Generated" folder for your solution.
    • Click the Advanced Options tab.
    • Set the Options you want.
    • Click OK.

    SQL Views

    • Click OK on the Template Instance screen.

    Save the Project

    • Click the Save As diskette icon (second from left).

    Save As

    • Choose a location, give the project a name, and click Save. (It will be given a .zprj extension.)

    Save As 2

    Run the Project

    • Select the root module (Demo).
    • Click the green arrow icon. (The right-most icon on the Demo project toolbar).
    • Double check the Status screen for possible run errors. (Hint: You can maximize the Status screen by double-clicking the Execution Status title bar.)
    •  Click Close.

    Status

    Summary

    You now have a MyGeneration project that you can open and run at any time. Because you cached the Default Settings for the module, it does not matter what your current Default Settings screen is set to. The project will always use the cached settings. And, it will regenerate all the tables and views you chose, with the options specified, into the output folder you designated.

    This just covers the very basics. A MyGeneration project can have many nested modules with different template instances running in each. For more information, see the MyGeneration help and forums. There is also a tutorial in the Articles section of the Template Archive.

View as RSS news feed in XML