Sample App

If you keenly followed the steps above, We can now construct our first App.

After successfully generation the code using Jenga. Rebuild the projects.

Go to toolbox and search for PageUser.

Drag drop it to FrmMain form.

using System; 
using System.Windows.Forms;

namespace HelloWorld
{
    public partial class FrmMain : Form
    {
        public FrmMain()
        {
            //check database connection
            Connection:
            try
            { 
                var db = Kt.Db; 
            }
            catch (Exception ex)
            {
                if (MessageBox.Show(ex.Message, "AppName", MessageBoxButtons.RetryCancel) == DialogResult.Cancel)
                    Environment.Exit(0);

                Kimtoo.DbManager.Connections.Show();
                goto Connection;
            }

            InitializeComponent();
        }

        private void btnConnection_Click(object sender, EventArgs e)
        {
            Kimtoo.DbManager.Connections.Show();
        }
    }
}
c

Run

Click Retry and add connections

Choose your database of choice.

My SQL

Make sure you have MySQL Installed and running.

Open the database and create at database e.g. jenga_demo

Update the connection info in the dialog.

Click save and Test the connection

Jenga Will check the connections and created the tables to match the model classes containing [AutogenerateTable] attribute

Changing Schema

If you modify the model schema, Jenga does not regenerate the table if exists. You have to change the schema manually or delete the table for jenga to regenerate.

Click close and the app ill resume to the main Form

If this error pops up, Simply uncheck the "break when this..... " and select continue.

Congratulations, You just built your first database application with Jenga

Last updated