Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Jeng InitDb

 public static void InitDb()
        {
            retry:
            try
            {
                //check in first time add default data
                //add fist employee
                if (Kt.Db.Count<Models.Employee>() == 0)
                    Kt.Db.Save(<Model Here>);

            }
            catch (Exception)
            {
                //connection faile show db options
                Kimtoo.DbManager.Connections.Show();
                try
                {
                    var db = Kt.Db;

                }
                catch (Exception err)
                {
                    if (MessageBox.Show(err.Message, "CONNECTON ERROR", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Retry)
                        goto retry;
                    Environment.Exit(0);
                }
            }
        }
 
PREVIOUS NEXT
Tagged: #Jeng #InitDb
ADD COMMENT
Topic
Name
1+9 =