public string CeneraterClass() { StringBuilder sb = new StringBuilder(); sb.AppendLine(getHeader()); if (mConnection.type == DbType.mysql.ToString()) { List <MyHelper.MysqlTableColumnSchema> schemas = new MyHelper.MySqlHelper(mConnection.connStr).getTableColumnSchema(mConnection.dbName, mTableName); for (int i = 0; i < schemas.Count; i++) { MyHelper.MysqlTableColumnSchema schema = schemas[i]; sb.AppendLine(getcomment(schema.commentValue, schema.isNullable, schema.defaultValue)); sb.AppendLine(getProerty(CSharpDbTypeMap.FindType(schema.type), schema.columnName)); sb.AppendLine(); } } else { List <MyHelper.SqliteTableSchema> schemas = new MyHelper.SQLiteHelper(mConnection.connStr).getTableSchema(mTableName); for (int i = 0; i < schemas.Count; i++) { MyHelper.SqliteTableSchema schema = schemas[i]; sb.AppendLine(getcomment(null, schema.notnull, schema.dflt_value)); sb.AppendLine(getProerty(CSharpDbTypeMap.FindType(schema.type), schema.name)); sb.AppendLine(); } } sb.AppendLine(tab + "}"); sb.AppendLine("}"); return(sb.ToString()); }
public string CeneraterClass() { StringBuilder sb = new StringBuilder(); sb.AppendLine(getHeader()); if (mConnection.type == DbType.mysql.ToString()) { mMysqlTableColumnSchema = new MyHelper.MySqlHelper(mConnection.connStr).getTableColumnSchema(mConnection.dbName, mTableName); for (int i = 0; i < mMysqlTableColumnSchema.Count; i++) { MyHelper.MysqlTableColumnSchema schema = mMysqlTableColumnSchema[i]; sb.AppendLine(getcomment(null, schema.isNullable, schema.defaultValue)); sb.AppendLine(tab + getProerty(JavaDbTypeMap.FindType(schema.type), schema.columnName)); sb.AppendLine(); } for (int i = 0; i < mMysqlTableColumnSchema.Count; i++) { MyHelper.MysqlTableColumnSchema schema = mMysqlTableColumnSchema[i]; string metodstr = getMethodComment(schema.commentValue); sb.AppendLine(metodstr); sb.AppendLine(getGet(JavaDbTypeMap.FindType(schema.type), MyHelper.StringHelper.DBNamingToCamelCase(schema.columnName))); sb.AppendLine(); sb.AppendLine(metodstr); sb.AppendLine(getSet(MyHelper.StringHelper.DBNamingToCamelCase(schema.columnName), JavaDbTypeMap.FindType(schema.type))); } } else { mSqliteTableSchemas = new MyHelper.SQLiteHelper(mConnection.connStr).getTableSchema(mTableName); for (int i = 0; i < mSqliteTableSchemas.Count; i++) { MyHelper.SqliteTableSchema schema = mSqliteTableSchemas[i]; sb.AppendLine(getcomment(null, schema.notnull, schema.dflt_value)); sb.AppendLine(tab + getProerty(JavaDbTypeMap.FindType(schema.type), schema.name)); sb.AppendLine(); } for (int i = 0; i < mSqliteTableSchemas.Count; i++) { MyHelper.SqliteTableSchema schema = mSqliteTableSchemas[i]; sb.AppendLine(getGet(JavaDbTypeMap.FindType(schema.type), MyHelper.StringHelper.DBNamingToCamelCase(schema.name))); sb.AppendLine(); sb.AppendLine(getSet(MyHelper.StringHelper.DBNamingToCamelCase(schema.name), JavaDbTypeMap.FindType(schema.type))); } } sb.AppendLine("}"); return(sb.ToString()); }