<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          AutoCode_vs2010C#代碼生成器

          聯(lián)合創(chuàng)作 · 2023-10-01 08:59

          AutoCode_vs2010 是 C# 代碼生成器

          1.代碼生成靈活,根據(jù)用戶所編輯的模板生成代碼。

          
          
          using System;
          using System.Collections.Generic;
          using System.Text;
          using System.IO;
          using ToolFunction;
          using System.Data;
          using CSScriptLibrary;
          using Microsoft.CSharp;
          using System.Reflection;
          using System.Windows.Forms;
          
          
          namespace AUTOCODE
          {
              ////// 測試類
              ///public class @GetClassName(SourceTable)
              {
          
                  @InitProperty(SourceTable)
                  
              }
          }
          
          	#START@GetCamelCaseName
           	public static string GetCamelCaseName(string value)
                  {
                      return value.ToLower();
                  }
          	#END
          	
          	#START@ConvertFirstCharToUpper
                  public static string ConvertFirstCharToUpper(string value)
                  {
                      return value.Substring(0, 1).ToUpper() + value.Substring(1);
                  }
          	#END
          
          	#START@InitProperty
          	///<summary>/// 生成屬性代碼
                  ///</summary>///<param name="p_dtSource">數(shù)據(jù)源</param>///<returns>字符串</returns>public static string InitProperty(DataTable p_dtSource)
                  {
                      string _strLine = "";
                      foreach (DataColumn item in p_dtSource.Columns)
                      {
                          _strLine += "\n private " + GetCSharpVariableType(item) + " " + item.ColumnName.ToLower() + ";";
                          _strLine += "\n" + "public " + GetCSharpVariableType(item) + " " + GetPropertyName(item.ColumnName);
                          _strLine += "\n" + "{ ";
                          _strLine += "\n" + "get { return " + item.ColumnName.ToLower() + ";}";
                          _strLine += "\n" + "set {" + item.ColumnName.ToLower() + "= value;}";
                          _strLine += "\n" + "}";
                      }
                      return _strLine;
                  }
          	#END
          	#START@GetClassName
                  ///<summary>/// 根據(jù)表生成類的名字
                  ///</summary>///<param name="p_dtTable">表</param>///<returns></returns>public static  string @GetClassName(DataTable p_dtTable)
                  {
                      if (p_dtTable == null)
                      {
                          return null;
                      }
                      string _strTemp =  p_dtTable.TableName.Substring(0, 1).ToUpper() + p_dtTable.TableName.Substring(1).ToLower();
                      return _strTemp;
                  }
          	#END
          
          	#START@GetPropertyName
                  ///<summary>/// 根據(jù)表名生成類
                  ///</summary>///<param name="p_strName"></param>///<returns></returns>public static  string GetPropertyName(string p_strName)
                  {
          
                      if (p_strName == null)
                      {
                          return null;
                      }
                      if (p_strName.Length == 1)
                      {
                          return p_strName.ToLower();
                      }
                      return p_strName.Substring(0, 1).ToUpper() + p_strName.Substring(1).ToLower();
                  }
          	#END
          
          	#START@GetLowerCaseName
                  public static  string GetLowerCaseName(string value)
                  {
                      return value.ToLower();
                  }
          	#END
          
          	#START@GetCSharpVariableType
          	///<summary>/// 根據(jù)表的列轉(zhuǎn)化代碼中的數(shù)據(jù)類型
                  ///</summary>///<param name="p_dcColumn">表列</param>///<returns></returns>public static  string GetCSharpVariableType(DataColumn p_dcColumn)
                  {
                      if (p_dcColumn.ColumnName.EndsWith("TypeCode")) return p_dcColumn.ColumnName;
          
                      switch (p_dcColumn.DataType.Name.ToString())
                      {
                          case "AnsiString": return "string";
                          case "AnsiStringFixedLength": return "string";
                          case "Binary": return "byte[]";
                          case "Boolean": return "bool";
                          case "Byte": return "byte";
                          case "Currency": return "decimal";
                          case "Date": return "DateTime";
                          case "DateTime": return "DateTime";
                          case "Decimal": return "decimal";
                          case "Double": return "double";
                          case "Guid": return "Guid";
                          case "Int16": return "short";
                          case "Int32": return "int";
                          case "Int64": return "long";
                          case "Object": return "object";
                          case "SByte": return "sbyte";
                          case "Single": return "float";
                          case "String": return "string";
                          case "StringFixedLength": return "string";
                          case "Time": return "TimeSpan";
                          case "UInt16": return "ushort";
                          case "UInt32": return "uint";
                          case "UInt64": return "ulong";
                          case "VarNumeric": return "decimal";
                          default:
                              {
                                  return "__UNKNOWN__";
                              }
                      }
                  }
          	#END
          
          
          using System;
          using System.Collections.Generic;
          using System.Text;
          using System.IO;
          using ToolFunction;
          using System.Data;
          using CSScriptLibrary;
          using Microsoft.CSharp;
          using System.Reflection;
          using System.Windows.Forms;
          
          
          namespace AUTOCODE
          {
              ////// 測試類
              ///public class @GetClassName(SourceTable)
              {
          
                  @InitProperty(SourceTable)
                  
              }
          }
          
          	#START@GetCamelCaseName
           	public static string GetCamelCaseName(string value)
                  {
                      return value.ToLower();
                  }
          	#END
          	
          	#START@ConvertFirstCharToUpper
                  public static string ConvertFirstCharToUpper(string value)
                  {
                      return value.Substring(0, 1).ToUpper() + value.Substring(1);
                  }
          	#END
          
          	#START@InitProperty
          	///<summary>/// 生成屬性代碼
                  ///</summary>///<param name="p_dtSource">數(shù)據(jù)源</param>///<returns>字符串</returns>public static string InitProperty(DataTable p_dtSource)
                  {
                      string _strLine = "";
                      foreach (DataColumn item in p_dtSource.Columns)
                      {
                          _strLine += "\n private " + GetCSharpVariableType(item) + " " + item.ColumnName.ToLower() + ";";
                          _strLine += "\n" + "public " + GetCSharpVariableType(item) + " " + GetPropertyName(item.ColumnName);
                          _strLine += "\n" + "{ ";
                          _strLine += "\n" + "get { return " + item.ColumnName.ToLower() + ";}";
                          _strLine += "\n" + "set {" + item.ColumnName.ToLower() + "= value;}";
                          _strLine += "\n" + "}";
                      }
                      return _strLine;
                  }
          	#END
          	#START@GetClassName
                  ///<summary>/// 根據(jù)表生成類的名字
                  ///</summary>///<param name="p_dtTable">表</param>///<returns></returns>public static  string @GetClassName(DataTable p_dtTable)
                  {
                      if (p_dtTable == null)
                      {
                          return null;
                      }
                      string _strTemp =  p_dtTable.TableName.Substring(0, 1).ToUpper() + p_dtTable.TableName.Substring(1).ToLower();
                      return _strTemp;
                  }
          	#END
          
          	#START@GetPropertyName
                  ///<summary>/// 根據(jù)表名生成類
                  ///</summary>///<param name="p_strName"></param>///<returns></returns>public static  string GetPropertyName(string p_strName)
                  {
          
                      if (p_strName == null)
                      {
                          return null;
                      }
                      if (p_strName.Length == 1)
                      {
                          return p_strName.ToLower();
                      }
                      return p_strName.Substring(0, 1).ToUpper() + p_strName.Substring(1).ToLower();
                  }
          	#END
          
          	#START@GetLowerCaseName
                  public static  string GetLowerCaseName(string value)
                  {
                      return value.ToLower();
                  }
          	#END
          
          	#START@GetCSharpVariableType
          	///<summary>/// 根據(jù)表的列轉(zhuǎn)化代碼中的數(shù)據(jù)類型
                  ///</summary>///<param name="p_dcColumn">表列</param>///<returns></returns>public static  string GetCSharpVariableType(DataColumn p_dcColumn)
                  {
                      if (p_dcColumn.ColumnName.EndsWith("TypeCode")) return p_dcColumn.ColumnName;
          
                      switch (p_dcColumn.DataType.Name.ToString())
                      {
                          case "AnsiString": return "string";
                          case "AnsiStringFixedLength": return "string";
                          case "Binary": return "byte[]";
                          case "Boolean": return "bool";
                          case "Byte": return "byte";
                          case "Currency": return "decimal";
                          case "Date": return "DateTime";
                          case "DateTime": return "DateTime";
                          case "Decimal": return "decimal";
                          case "Double": return "double";
                          case "Guid": return "Guid";
                          case "Int16": return "short";
                          case "Int32": return "int";
                          case "Int64": return "long";
                          case "Object": return "object";
                          case "SByte": return "sbyte";
                          case "Single": return "float";
                          case "String": return "string";
                          case "StringFixedLength": return "string";
                          case "Time": return "TimeSpan";
                          case "UInt16": return "ushort";
                          case "UInt32": return "uint";
                          case "UInt64": return "ulong";
                          case "VarNumeric": return "decimal";
                          default:
                              {
                                  return "__UNKNOWN__";
                              }
                      }
                  }
          	#END



          2.提供模板文件管理模塊。

          3.提供基礎(chǔ)配置模塊,方便數(shù)據(jù)庫連接,導出目錄設(shè)置。

          4.模板包含屬性說明區(qū),函數(shù)注冊區(qū),靜態(tài)文本區(qū),動態(tài)函數(shù)區(qū)。規(guī)范嚴謹,易于書寫編輯。

          5.通過動態(tài)編譯實現(xiàn)了模板中可添加c#函數(shù),對數(shù)據(jù)源進行動態(tài)操作。

          6.多種文件格式導出(只有想生成的文件與數(shù)據(jù)表有緊密聯(lián)系,均可根據(jù)動態(tài)函數(shù)區(qū)的代碼進行代碼生成)

          未完成功能

          支持SqlServer、mysql.



          瀏覽 12
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  午夜性爱免费视频 | 人妻AV影院 | 日韩成人电影在线观看 | 亚洲婷婷在线 | 一级a片欧美 |