因爲CodeSmith鏈接MySql的dll有點小Bug,沒法獲取表和列的描述信息,因此,須要從新修改驅動程序。mysql
如上圖所示,CodeSmith的mysql驅動是沒法獲取表和列的描述。因此咱們須要從新修改MySQLSchemaProvide。步驟以下:sql
if (schemaObject is TableSchema) { TableSchema tableSchema = schemaObject as TableSchema; string commandText = string.Format(@"SHOW CREATE TABLE `{0}`.`{1}`", tableSchema.Database.Name, tableSchema.Name); using (DbConnection connection = CreateConnection(connectionString)) { connection.Open(); DbCommand command = connection.CreateCommand(); command.CommandText = commandText; command.Connection = connection; using (IDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection)) { while (reader.Read()) { string createtable = reader.GetString(1); extendedProperties.Add(new ExtendedProperty("CS_CreateTableScript", createtable, DbType.String)); } if (!reader.IsClosed) reader.Close(); } if (connection.State != ConnectionState.Closed) connection.Close(); } }
若須要完成的dll,能夠留下郵件地址。抽空能夠發送完成的dll給你們。ide