示例#1
0
        public String CreateFiles([FromBody] JObject objectData)
        {
            SetObjectData(objectData);
            string      fileExtn   = codeType.StartsWith('C') ? ".cs" : ".ts";
            IDBHelper   dbhelper   = DBFactory.GetDBInstance(connectStr, DBType.Sqlite);
            ICodeHelper codeHelper = DBFactory.GetCodeHelper(codeType, orm);
            DataTable   dtTables   = dbhelper.GetTables();
            FileHelper  fileHelper = new FileHelper();
            String      tableName  = String.Empty;
            DataTable   dtColumns  = null;

            foreach (DataRow dr in dtTables.Rows)
            {
                tableName = dr["Name"].ToString();
                dtColumns = dbhelper.GetColumns(tableName);
                String code = codeHelper.GetCode(tableName, orm, dtTables, dtColumns);
                fileHelper.WriteFile(tableName + fileExtn, code);
            }
            return("Process Complete");
        }
示例#2
0
        public string GetCode([FromBody] JObject objectData)
        {
            String code = String.Empty;

            SetObjectData(objectData);
            IDBHelper   dbhelper   = DBFactory.GetDBInstance(connectStr, DBType.Sqlite);
            ICodeHelper codeHelper = DBFactory.GetCodeHelper(codeType, orm);
            DataTable   dtTables   = null;
            DataTable   dtColumns  = null;

            if (codeType.Equals("CSharpDBContext", StringComparison.InvariantCultureIgnoreCase))
            {
                dtTables = dbhelper.GetTables();
            }
            if (codeType.Equals("CSharpEntity", StringComparison.InvariantCultureIgnoreCase) ||
                codeType.Equals("TypeScript", StringComparison.InvariantCultureIgnoreCase))
            {
                dtColumns = dbhelper.GetColumns(tableName);
            }
            code = codeHelper.GetCode(tableName, orm, dtTables, dtColumns);
            return(code);
        }