CodeSmith7 connecting MySQL

Source: Internet
Author: User
Tags mysql client

Since the Codesmith connection to MySQL DLL is a bit small bug, unable to get the table and column description information, so, need to re-modify the driver.

As shown, the Codesmith MySQL driver is unable to get a description of the tables and columns. So we need to re-modify Mysqlschemaprovide. The steps are as follows:

  1. Follow the path to open the project.
  2. Note that you need to reintroduce the DLL.
  3. Open the MySQL client program and view the table structure and column structure first.
  4. Open the project, modify the code, the key code is as follows:
  5. Above is the addition of the table description column, the method below is a description of the table, the original content is:
    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 (); }            }
  6. Modify the above SQL statement to select Table_name,table_comment from Information_schema. ' TABLES ' where table_schema= ' {0} ' and table_name= ' {1} '. and will Extendedproperties.add (new Extendedproperty ("Cs_createtablescript", CreateTable, dbtype.string)); Extendedproperties.add (New Extendedproperty ("Cs_description", CreateTable, dbtype.string));
  7. After recompiling, replace the compiled DLL component with the DLL inside the CODESMITH7. Path
  8. Eventually

If you need to complete the DLL, you can leave the email address. Take the time to send the completed DLL to everyone.

CodeSmith7 connecting MySQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.