标签:
由于CodeSmith连接MySql的dll有点小Bug,无法获取表和列的描述信息,所以,需要重新修改驱动程序。
如上图所示,CodeSmith的mysql驱动是无法获取表和列的描述。所以我们需要重新修改MySQLSchemaProvide。步骤如下:
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给大家。
标签:
原文地址:http://www.cnblogs.com/elqy/p/4193024.html