Ejemplo n.º 1
0
        static void Main()
        {
            try
            {
                //生成实体
                Sugar sqlSugar = new Sugar();
                sqlSugar.setCon(AppConfSetting.ConnectionString);
                sqlSugar.sugarClient.Open();
                sqlSugar.sugarClient.DbFirst
                .IsCreateDefaultValue().IsCreateAttribute().CreateClassFile("D:\\Models", "Ris.Dal.Entitys");
                sqlSugar.sugarClient.Close();


                //设置应用程序处理异常方式:ThreadException处理
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                //处理UI线程异常
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
                //处理非UI线程异常
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                #region 应用程序的主入口点
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                //Application.Run(new DeptSettingForm());
                Application.Run(new LoginForm());
                #endregion
            }
            catch (Exception ex)
            {
                string str = GetExceptionMsg(ex, string.Empty);
                MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                NLogger.LogError(str, ex);
                Application.Exit();
            }
        }