Exemple #1
0
        private string GenerateModel(string DBName)
        {
            try
            {
                if (!String.IsNullOrEmpty(DBName))
                {
                    ModelHelper model = new ModelHelper();
                    //DbType type = DbType.SqlServer;
                    SqlSugar.DbType ty = SqlSugar.DbType.SqlServer;
                    switch (Constraint.value)
                    {
                    case 3:
                        //type = DbType.MySql;
                        ty = SqlSugar.DbType.MySql;
                        break;

                    case 4:
                        //type = DbType.MySql;
                        ty = SqlSugar.DbType.Oracle;
                        break;
                    }
                    string json = model.GetTableJson(DBName, ty);
                    return(Common.format(model.ModelCreate(json, "MeiCloud.DataAccess")));
                }
                return("");
            }
            catch (Exception ex)
            {
                Warning warning = new Warning(ex.Message);
                warning.ShowDialog();
                return("");
            }
        }
Exemple #2
0
        private async void ModelRun()
        {
            await Task.Run(() =>
            {
                if (!string.IsNullOrEmpty(DBName))
                {
                    ModelHelper model  = new ModelHelper();
                    SqlSugar.DbType ty = SqlSugar.DbType.SqlServer;
                    switch (Constraint.value)
                    {
                    case 3:
                        ty = SqlSugar.DbType.MySql;
                        break;

                    case 4:
                        ty = SqlSugar.DbType.Oracle;
                        break;
                    }
                    string json = model.GetTableJson(DBName, ty);
                    if (IsSugar)
                    {
                        SqlText = Common.format(model.ModelCreate(json, "MeiCloud.DataAccess", "Sugar"));
                    }
                    else
                    {
                        SqlText = Common.format(model.ModelCreate(json, "MeiCloud.DataAccess"));
                    }

                    SqlText = SqlText.Replace("\nusing Creative.ODA;", "");
                    Loading.Framework.HideLoading();
                }
            }).ConfigureAwait(true);
        }