C # code generator (stored procedure generation method)

Source: Internet
Author: User

Recently study C #, found that writing code is very troublesome, especially to create entities, models, interfaces, factories, stored procedures and so on, some open-source online, but incomplete, can not be complete on demand generation, so, spent three days, combined with some of the experience of predecessors, integration of some code generator, the following is the method of generating stored procedures , you can use for reference, the level is limited, please give more advice.

1  /// <summary>2         ///create a stored procedure3         /// </summary> 4          Public stringgetstorage (codetable codetable)5         {6 7Model.servers Server =Common.Config.GetServer (Codetable.serverid);8             if(Server = =NULL)9             {Ten                 return string. Empty; One             } AStringBuilder storage =NewStringBuilder (import. Getimport_storage ()); -  -             stringDbName =Codetable.dbname; the             stringTableName =Codetable.tablename; -DataSet DataSet =idata. RunQuery (Codetable.serverid, DbName, tableName); -datarow[] rows = dataset.tables[0]. Select ("table_name = '"+ TableName +"'"); -  +             foreach(DataRow Drinchrows) -             { +                 stringPrefix ="Lls_"; AStorage. Append (Createselectall (Prefix + tableName +"_selectall", TableName, rows) +"\r\n\r\n"); atStorage. Append (Createselectrow (Prefix + tableName +"_selectrow", TableName, rows) +"\r\n\r\n"); -Storage. Append (Createinsert (Prefix + tableName +"_insert", TableName, rows) +"\r\n\r\n"); -Storage. Append (createupdate (Prefix + tableName +"_update", TableName, rows) +"\r\n\r\n"); -Storage. Append (Createdeleterow (Prefix + tableName +"_deleterow", TableName, rows) +"\r\n\r\n"); -                  Break; -             } in             returnstorage. ToString (); -}

C # code generator (stored procedure generation method)

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.