└── CodeAutogenerationTool ├── .vs └── CodeAutogenerationTool │ └── v15 │ ├── .suo │ └── Server │ └── sqlite3 │ ├── db.lock │ ├── storage.ide │ ├── storage.ide-shm │ └── storage.ide-wal ├── App.config ├── App_Data ├── CodeAutogenerationTool.xml ├── Log4Net.config └── lib │ ├── EasyFramework.dll │ ├── EasyFramework.xml │ ├── Spring.Core.dll │ ├── Spring.Data.dll │ └── Spring.Web.dll ├── CodeAutogenerationTool.csproj ├── CodeAutogenerationTool.csproj.user ├── CodeAutogenerationTool.sln ├── CodeAutogenerationTool.v11.suo ├── Helper └── MSSqlAutoGenerationHelper.cs ├── Images ├── exit.png ├── help.png ├── link.png └── unlink.png ├── MForm ├── MainForm.Designer.cs ├── MainForm.cs └── MainForm.resx ├── Models └── ListItem.cs ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings └── UpgradeLog.htm /CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/.suo -------------------------------------------------------------------------------- /CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/Server/sqlite3/db.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/Server/sqlite3/db.lock -------------------------------------------------------------------------------- /CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/Server/sqlite3/storage.ide: -------------------------------------------------------------------------------- 1 | SQLite format 3@ .A  -------------------------------------------------------------------------------- /CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/Server/sqlite3/storage.ide-shm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/Server/sqlite3/storage.ide-shm -------------------------------------------------------------------------------- /CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/Server/sqlite3/storage.ide-wal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/.vs/CodeAutogenerationTool/v15/Server/sqlite3/storage.ide-wal -------------------------------------------------------------------------------- /CodeAutogenerationTool/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/App_Data/CodeAutogenerationTool.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/App_Data/Log4Net.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/App_Data/lib/EasyFramework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/App_Data/lib/EasyFramework.dll -------------------------------------------------------------------------------- /CodeAutogenerationTool/App_Data/lib/EasyFramework.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EasyFramework 5 | 6 | 7 | 8 | 9 | 控制器基类 10 | 11 | 12 | 13 | 14 | 数据库访问类 15 | 16 | 17 | 18 | 19 | 20 | 基类属性 21 | 22 | 23 | 24 | 25 | 错误消息 26 | 27 | 28 | 29 | 30 | 数据库表与模型属性的映射 31 | 32 | 33 | 34 | 35 | 缺省构造函数 36 | 37 | 38 | 39 | 40 | 有参构造函数 41 | 42 | 表名 43 | 主键 44 | 45 | 46 | 47 | 映射数据库表名 48 | 49 | 50 | 51 | 52 | 映射数据库主键 53 | 54 | 55 | 56 | 57 | Model属性 58 | 59 | 60 | 61 | 62 | 缺省构造函数 63 | 64 | 65 | 66 | 67 | 基本构造函数 68 | 69 | 列名 70 | 字段类型 71 | 72 | 73 | 74 | 列名 75 | 76 | 77 | 78 | 79 | 字段类型 80 | 81 | 82 | 83 | 84 | 字段说明 85 | 86 | 87 | 88 | 89 | 能否为空 90 | 91 | 92 | 93 | 94 | 默认值 95 | 96 | 97 | 98 | 99 | 最小长度 100 | 101 | 102 | 103 | 104 | 最大长度 105 | 106 | 107 | 108 | 109 | 控制器属性 110 | 111 | 112 | 113 | 114 | 错误消息 115 | 116 | 117 | 118 | 119 | 控制器基类 120 | 121 | 122 | 123 | 124 | 获取一个已经实例化的数据库帮助类 125 | 126 | 一个已经实例化的数据库帮助类 127 | 128 | 129 | 130 | 判断是否是移动端 131 | 132 | 是移动端返回true否则返回false 133 | 134 | 135 | 136 | MS Sql Server的DBType 137 | 138 | 139 | 140 | 141 | 根据类型名称返回对应的Sql Server类型 142 | 143 | 数据库类型名称 144 | 对应的数据库类型 145 | 146 | 147 | 148 | 根据Sql Server的类型名称获取对应的C#类型 149 | 150 | Sql Server类型名称 151 | 对应C#中的类型 152 | 153 | 154 | 155 | 数据库访问类 156 | 157 | 158 | 159 | 160 | 缺省无参构造函数 161 | 162 | 163 | 164 | 165 | 有参构造函数 166 | 167 | sql连接字符串 168 | 169 | 170 | 171 | 执行Sql语句返回受影响行数 172 | 是对Spring中ExecuteNonQuery(CommandType.Text, sql)的封装 173 | 174 | 执行的sql语句 175 | /// 可选sql参数 176 | 返回受影响的行数 177 | 178 | 179 | 180 | 返回sql语句结果第一行第一列 泛型 181 | 182 | 类型 183 | sql语句 184 | 可选参数 185 | 186 | 187 | 188 | 189 | 返回sql语句结果第一行第一列 如无结果或异常则返回null 在逻辑层只需判断是否为null即可 190 | 191 | 查询语句 192 | 可选参数 193 | 194 | 195 | 196 | 197 | 根据sql语句查询结果, 并返回DataTable, 如有多个表只返回第一个table 198 | 199 | sql执行语句 200 | 可选参数 201 | 返回一个数据表集 202 | 203 | 204 | 205 | 根据sql语句查询结果, 返回查询数据集 206 | 207 | sql语句 208 | 可选参数 209 | 返回dataset数据集 210 | 211 | 212 | 213 | 关闭与数据库的持续连接 214 | 215 | 关闭指向数据库连接 216 | 217 | 218 | 219 | 模型基类 220 | 221 | 222 | 223 | 224 | 获取实例化之后的数据库帮助类 225 | 226 | 一个已经实例化的数据库访问类 227 | 228 | 229 | 230 | 更新或保存当前类 231 | 232 | true保存成功 false保存失败 233 | 234 | 235 | 236 | 根据model主键删除对应一条数据 237 | 238 | true删除成功, 否则删除失败,删除失败时请检查表主键 239 | 240 | 241 | 242 | 通过主键ID获取一个指定对象, 需有无参构造函数, 以及对象为引用类型 243 | 244 | 获取对象的类型 245 | 主键id 246 | 返回指定对象实例 247 | 248 | 249 | 250 | 根据条件查询多个对象 251 | 252 | 返回对象类型 253 | 查询条件 254 | 返回对应的泛型结果 255 | 256 | 257 | 258 | 在数据库更新当前类 259 | 260 | true更新成功, false更新失败 261 | 262 | 263 | 264 | 在数据库中插入一条新的数据 265 | 266 | 返回一个bool值, true表示插入成功, 否则失败 267 | 268 | 269 | 270 | 获取类字段信息 271 | 272 | 返回一个Key为字段名, Value为字段属性的字典 273 | 274 | 275 | 276 | 获取所有所传类字段的可访问属性 277 | 278 | 访问类 279 | 所有字段属性数组 280 | 281 | 282 | 283 | 获取模型类特性 284 | 285 | 返回当前调用模型类的特性 286 | 287 | 288 | 289 | 数据库查询条件类 290 | 291 | 292 | 293 | 294 | 基本构造函数 295 | 296 | 查询条件 例如: Where 1 = 1 297 | 298 | 299 | 300 | 查询条件 301 | 302 | 查询条件 例如: Where 1 = 1 303 | 排序列名称 304 | 排序,默认为0, 0为升序, 否则为降序(非0对应desc) 305 | 306 | 307 | 308 | 查询条件 例如: Where 1 = 1 309 | 310 | 311 | 312 | 313 | 排序列名称 314 | 315 | 316 | 317 | 318 | 排序,默认为0, 0为升序, 否则为降序 319 | 320 | 321 | 322 | 323 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/App_Data/lib/Spring.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/App_Data/lib/Spring.Core.dll -------------------------------------------------------------------------------- /CodeAutogenerationTool/App_Data/lib/Spring.Data.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/App_Data/lib/Spring.Data.dll -------------------------------------------------------------------------------- /CodeAutogenerationTool/App_Data/lib/Spring.Web.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/App_Data/lib/Spring.Web.dll -------------------------------------------------------------------------------- /CodeAutogenerationTool/CodeAutogenerationTool.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {88491668-A04A-4073-91FD-29398EBE9B41} 8 | WinExe 9 | CodeAutogenerationTool 10 | CodeAutogenerationTool 11 | v4.5 12 | 512 13 | true 14 | false 15 | D:\Home\Release\CodeAutogenerationTool\ 16 | true 17 | Disk 18 | false 19 | Foreground 20 | 7 21 | Days 22 | false 23 | false 24 | true 25 | true 26 | 1 27 | 1.0.0.%2a 28 | false 29 | true 30 | true 31 | 32 | 33 | AnyCPU 34 | true 35 | full 36 | false 37 | bin\Debug\ 38 | DEBUG;TRACE 39 | prompt 40 | 4 41 | 42 | 43 | AnyCPU 44 | pdbonly 45 | true 46 | bin\Release\ 47 | TRACE 48 | prompt 49 | 4 50 | 51 | 52 | true 53 | 54 | 55 | 3B44BB4BD6F53D56C34D160C3498C2EABAC8DD62 56 | 57 | 58 | true 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | False 67 | App_Data\lib\EasyFramework.dll 68 | 69 | 70 | App_Data\lib\Spring.Core.dll 71 | 72 | 73 | App_Data\lib\Spring.Data.dll 74 | 75 | 76 | App_Data\lib\Spring.Web.dll 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | Form 98 | 99 | 100 | MainForm.cs 101 | 102 | 103 | 104 | 105 | 106 | MainForm.cs 107 | 108 | 109 | ResXFileCodeGenerator 110 | Resources.Designer.cs 111 | Designer 112 | 113 | 114 | True 115 | Resources.resx 116 | True 117 | 118 | 119 | 120 | SettingsSingleFileGenerator 121 | Settings.Designer.cs 122 | 123 | 124 | True 125 | Settings.settings 126 | True 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | False 143 | .NET Framework 3.5 SP1 144 | false 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/CodeAutogenerationTool.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ProjectFiles 5 | D:\Home\Release\CodeAutogenerationTool\ 6 | 7 | 8 | 9 | 10 | 11 | zh-CN 12 | false 13 | 14 | 15 | false 16 | 17 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/CodeAutogenerationTool.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAutogenerationTool", "CodeAutogenerationTool.csproj", "{88491668-A04A-4073-91FD-29398EBE9B41}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {88491668-A04A-4073-91FD-29398EBE9B41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {88491668-A04A-4073-91FD-29398EBE9B41}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {88491668-A04A-4073-91FD-29398EBE9B41}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {88491668-A04A-4073-91FD-29398EBE9B41}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ExtensibilityGlobals) = postSolution 21 | SolutionGuid = {4AE5A2CF-6818-4140-A264-5C3AD242CEE9} 22 | EndGlobalSection 23 | EndGlobal 24 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/CodeAutogenerationTool.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/CodeAutogenerationTool.v11.suo -------------------------------------------------------------------------------- /CodeAutogenerationTool/Helper/MSSqlAutoGenerationHelper.cs: -------------------------------------------------------------------------------- 1 | using EasyFramework.Attr; 2 | using EasyFramework.Core.Enum; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Text; 7 | 8 | namespace CodeAutogenerationTool.Helper 9 | { 10 | /// 11 | /// MS Sql代码自动生成 12 | /// 13 | class MSSqlAutoGenerationHelper 14 | { 15 | public static string path = "";//生成代码路径 16 | public static string nameSpace = "";//命名空间 17 | 18 | /// 19 | /// 生成MVC中的MC 20 | /// 21 | /// 类字段信息 22 | /// 表信息 23 | /// 返回true表示生成成功, 否则失败 24 | public static bool GenerateMC(List modelProperties, ModelAttribute modelAttribute) 25 | { 26 | return GenerateModel(modelProperties, modelAttribute) && GenerateController(modelAttribute); 27 | } 28 | 29 | /// 30 | /// 生成Model 31 | /// 32 | /// 类字段信息 33 | /// 表信息 34 | /// 返回true表示生成成功, 否则失败 35 | public static bool GenerateModel(List modelProperties, ModelAttribute modelAttribute) 36 | { 37 | StringBuilder sb = new StringBuilder(); 38 | sb.Append("using System;\n"); 39 | sb.Append("using EasyFramework.Attr;\n"); 40 | sb.Append("using EasyFramework.Models;\n"); 41 | sb.Append(string.Format("namespace {0}.Models\n", nameSpace)); 42 | sb.Append("{\n"); 43 | sb.Append(string.Format(" [Model(\"{0}\", \"{1}\")]\n", modelAttribute.TableName, modelAttribute.PrimaryKey)); 44 | sb.Append(string.Format(" public class {0} : BaseModel\n", modelAttribute.TableName)); 45 | sb.Append(" {\n"); 46 | foreach (ModelProperty modelProperty in modelProperties) 47 | { 48 | //字段类型 49 | string type = ""; 50 | //字段长度信息 51 | string lengthInfo = ""; 52 | //字段默认值 53 | string _default = string.IsNullOrEmpty(modelProperty.Default) ? "" : string.Format(", Default = \"{0}\"", modelProperty.Default); 54 | //说明 55 | string explain = string.IsNullOrEmpty(modelProperty.Explain) ? "" : string.Format(", Explain = \"{0}\"", modelProperty.Explain); 56 | //能否为空 57 | string IsNull = string.Format(", IsNull = {0}", modelProperty.IsNull.ToString().ToLower()); 58 | switch (MSDBType.GetTypeBySqlTypeName(modelProperty.ColType).Name) 59 | { 60 | case "String": 61 | type = "string"; 62 | lengthInfo = string.Format(", MinLength = {0}, MaxLength = {1}", modelProperty.MinLength, modelProperty.MaxLength); 63 | break; 64 | case "Int32": 65 | type = "int"; 66 | break; 67 | case "Boolean": 68 | type = "bool"; 69 | break; 70 | case "DateTime": 71 | type = "DateTime"; 72 | break; 73 | case "Double": 74 | type = "double"; 75 | break; 76 | } 77 | sb.Append(string.Format(" [ModelProperty(\"{0}\", \"{1}\"{2}{3}{4}{5})]\n", modelProperty.ColName, modelProperty.ColType, lengthInfo, _default, explain, IsNull)); 78 | sb.Append(string.Format(" public {0} {1} {2}\n\n", type, modelProperty.ColName, "{ get; set; }")); 79 | } 80 | sb.Append(" }\n"); 81 | sb.Append("}"); 82 | try 83 | { 84 | FileStream fs = new FileStream(string.Format("{0}/Models/{1}.cs", path, modelAttribute.TableName), FileMode.Create); 85 | byte[] bytes = Encoding.UTF8.GetBytes(sb.ToString()); 86 | fs.Write(bytes, 0, bytes.Length); 87 | fs.Close(); 88 | GenerateLog4Net(); 89 | } 90 | catch (Exception e) 91 | { 92 | string sss = e.Message; 93 | return false; 94 | } 95 | return true; 96 | } 97 | 98 | /// 99 | /// 生成MVC中的C 100 | /// 101 | /// 表信息 102 | /// true表示生成成功 否则 失败 103 | public static bool GenerateController(ModelAttribute modelAttribute) 104 | { 105 | StringBuilder sb = new StringBuilder(); 106 | sb.Append("using System;\n"); 107 | sb.Append("using System.Web;\n"); 108 | sb.Append("using System.Web.Mvc;\n"); 109 | sb.Append("using System.Collections.Generic;\n"); 110 | sb.Append("using EasyFramework.Core;\n"); 111 | sb.Append(string.Format("namespace {0}.Controllers\n", nameSpace)); 112 | sb.Append("{\n"); 113 | sb.Append(string.Format(" public class {0}Controller : BaseController\n", modelAttribute.TableName)); 114 | sb.Append(" {\n"); 115 | sb.Append(" public ActionResult Index()\n"); 116 | sb.Append(" {\n"); 117 | sb.Append(" return View();\n"); 118 | sb.Append(" }\n"); 119 | sb.Append(" }\n"); 120 | sb.Append("}\n"); 121 | try 122 | { 123 | FileStream fs = new FileStream(string.Format("{0}/Controllers/{1}Controller.cs", path, modelAttribute.TableName), FileMode.Create); 124 | byte[] bytes = Encoding.UTF8.GetBytes(sb.ToString()); 125 | fs.Write(bytes, 0, bytes.Length); 126 | fs.Close(); 127 | GenerateLog4Net(); 128 | } 129 | catch (Exception) 130 | { 131 | return false; 132 | } 133 | return true; 134 | } 135 | 136 | /// 137 | /// 生成三层中的DAL 138 | /// 139 | /// 类字段信息 140 | /// 表信息 141 | /// 返回true表示生成成功, 否则失败 142 | public static bool GenerateDAL(List modelProperties, ModelAttribute modelAttribute) 143 | { 144 | return false; 145 | } 146 | 147 | #region 公用配置创建 148 | 149 | /// 150 | /// 生成log4net配置文件 151 | /// 152 | private static void GenerateLog4Net() 153 | { 154 | if (!Directory.Exists(path + @"\bin")) 155 | { 156 | Directory.CreateDirectory(path + @"\bin"); 157 | } 158 | if (!File.Exists(path + @"\bin\Log4Net.config")) 159 | { 160 | bool c = File.Exists("Log4Net.config"); 161 | File.Copy("Log4Net.config", path + "/bin/Log4Net.config"); 162 | } 163 | } 164 | 165 | #endregion 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/Images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/Images/exit.png -------------------------------------------------------------------------------- /CodeAutogenerationTool/Images/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/Images/help.png -------------------------------------------------------------------------------- /CodeAutogenerationTool/Images/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/Images/link.png -------------------------------------------------------------------------------- /CodeAutogenerationTool/Images/unlink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/Images/unlink.png -------------------------------------------------------------------------------- /CodeAutogenerationTool/MForm/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace CodeAutogenerationTool.MForm 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); 33 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); 34 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); 35 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); 36 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); 37 | this.MainMenuStrip = new System.Windows.Forms.MenuStrip(); 38 | this.菜单ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 39 | this.MenuItem_Help = new System.Windows.Forms.ToolStripMenuItem(); 40 | this.MenuItem_Exit = new System.Windows.Forms.ToolStripMenuItem(); 41 | this.toolStrip1 = new System.Windows.Forms.ToolStrip(); 42 | this.tsbtn_Connect = new System.Windows.Forms.ToolStripButton(); 43 | this.tsbtn_Disconnect = new System.Windows.Forms.ToolStripButton(); 44 | this.tsbtn_Exit = new System.Windows.Forms.ToolStripButton(); 45 | this.TabPage = new System.Windows.Forms.TabControl(); 46 | this.tabPage1 = new System.Windows.Forms.TabPage(); 47 | this.btn_Close = new System.Windows.Forms.Button(); 48 | this.txt_DataBaseName = new System.Windows.Forms.TextBox(); 49 | this.lbl_Tips = new System.Windows.Forms.LinkLabel(); 50 | this.btn_SelectPath = new System.Windows.Forms.Button(); 51 | this.lbl_Path = new System.Windows.Forms.Label(); 52 | this.txt_Path = new System.Windows.Forms.TextBox(); 53 | this.lbl_NameSpace = new System.Windows.Forms.Label(); 54 | this.txt_NameSpace = new System.Windows.Forms.TextBox(); 55 | this.lbl_DataBaseName = new System.Windows.Forms.Label(); 56 | this.btn_Connect = new System.Windows.Forms.Button(); 57 | this.lbl_Pwd = new System.Windows.Forms.Label(); 58 | this.txt_Pwd = new System.Windows.Forms.TextBox(); 59 | this.lbl_UserName = new System.Windows.Forms.Label(); 60 | this.txt_UserName = new System.Windows.Forms.TextBox(); 61 | this.lbl_DataBaseType = new System.Windows.Forms.Label(); 62 | this.cbb_DataBaseType = new System.Windows.Forms.ComboBox(); 63 | this.lbl_Ip = new System.Windows.Forms.Label(); 64 | this.txt_Ip = new System.Windows.Forms.TextBox(); 65 | this.tabPage2 = new System.Windows.Forms.TabPage(); 66 | this.lbl_Mode = new System.Windows.Forms.Label(); 67 | this.cbb_Mode = new System.Windows.Forms.ComboBox(); 68 | this.lbl_TableName = new System.Windows.Forms.Label(); 69 | this.dgv_TableDetails = new System.Windows.Forms.DataGridView(); 70 | this.Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); 71 | this.FieldName = new System.Windows.Forms.DataGridViewTextBoxColumn(); 72 | this.FieldDescribe = new System.Windows.Forms.DataGridViewTextBoxColumn(); 73 | this.FieldType = new System.Windows.Forms.DataGridViewTextBoxColumn(); 74 | this.FieldLength = new System.Windows.Forms.DataGridViewTextBoxColumn(); 75 | this.IsPrimaryKey = new System.Windows.Forms.DataGridViewTextBoxColumn(); 76 | this.IsNull = new System.Windows.Forms.DataGridViewTextBoxColumn(); 77 | this.FieldDefaultValue = new System.Windows.Forms.DataGridViewTextBoxColumn(); 78 | this.btn_Read = new System.Windows.Forms.Button(); 79 | this.btn_Generate = new System.Windows.Forms.Button(); 80 | this.cbb_Tables = new System.Windows.Forms.ComboBox(); 81 | this.tabPage3 = new System.Windows.Forms.TabPage(); 82 | this.txt_Msg = new System.Windows.Forms.TextBox(); 83 | this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); 84 | this.MainMenuStrip.SuspendLayout(); 85 | this.toolStrip1.SuspendLayout(); 86 | this.TabPage.SuspendLayout(); 87 | this.tabPage1.SuspendLayout(); 88 | this.tabPage2.SuspendLayout(); 89 | ((System.ComponentModel.ISupportInitialize)(this.dgv_TableDetails)).BeginInit(); 90 | this.tabPage3.SuspendLayout(); 91 | this.SuspendLayout(); 92 | // 93 | // MainMenuStrip 94 | // 95 | this.MainMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); 96 | this.MainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 97 | this.菜单ToolStripMenuItem}); 98 | this.MainMenuStrip.Location = new System.Drawing.Point(0, 0); 99 | this.MainMenuStrip.Name = "MainMenuStrip"; 100 | this.MainMenuStrip.Size = new System.Drawing.Size(1016, 28); 101 | this.MainMenuStrip.TabIndex = 0; 102 | // 103 | // 菜单ToolStripMenuItem 104 | // 105 | this.菜单ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 106 | this.MenuItem_Help, 107 | this.MenuItem_Exit}); 108 | this.菜单ToolStripMenuItem.Name = "菜单ToolStripMenuItem"; 109 | this.菜单ToolStripMenuItem.Size = new System.Drawing.Size(51, 24); 110 | this.菜单ToolStripMenuItem.Text = "菜单"; 111 | // 112 | // MenuItem_Help 113 | // 114 | this.MenuItem_Help.Image = ((System.Drawing.Image)(resources.GetObject("MenuItem_Help.Image"))); 115 | this.MenuItem_Help.Name = "MenuItem_Help"; 116 | this.MenuItem_Help.Size = new System.Drawing.Size(136, 26); 117 | this.MenuItem_Help.Text = "帮助(&H)"; 118 | this.MenuItem_Help.Click += new System.EventHandler(this.MenuItem_Help_Click); 119 | // 120 | // MenuItem_Exit 121 | // 122 | this.MenuItem_Exit.Image = ((System.Drawing.Image)(resources.GetObject("MenuItem_Exit.Image"))); 123 | this.MenuItem_Exit.Name = "MenuItem_Exit"; 124 | this.MenuItem_Exit.Size = new System.Drawing.Size(136, 26); 125 | this.MenuItem_Exit.Text = "退出(&X)"; 126 | this.MenuItem_Exit.Click += new System.EventHandler(this.MenuItem_Exit_Click); 127 | // 128 | // toolStrip1 129 | // 130 | this.toolStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); 131 | this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 132 | this.tsbtn_Connect, 133 | this.tsbtn_Disconnect, 134 | this.tsbtn_Exit}); 135 | this.toolStrip1.Location = new System.Drawing.Point(0, 28); 136 | this.toolStrip1.Name = "toolStrip1"; 137 | this.toolStrip1.Size = new System.Drawing.Size(1016, 27); 138 | this.toolStrip1.TabIndex = 1; 139 | this.toolStrip1.Text = "toolStrip1"; 140 | // 141 | // tsbtn_Connect 142 | // 143 | this.tsbtn_Connect.Image = ((System.Drawing.Image)(resources.GetObject("tsbtn_Connect.Image"))); 144 | this.tsbtn_Connect.ImageTransparentColor = System.Drawing.Color.Magenta; 145 | this.tsbtn_Connect.Name = "tsbtn_Connect"; 146 | this.tsbtn_Connect.Size = new System.Drawing.Size(63, 24); 147 | this.tsbtn_Connect.Text = "连接"; 148 | this.tsbtn_Connect.Click += new System.EventHandler(this.btn_Connect_Click); 149 | // 150 | // tsbtn_Disconnect 151 | // 152 | this.tsbtn_Disconnect.Enabled = false; 153 | this.tsbtn_Disconnect.Image = ((System.Drawing.Image)(resources.GetObject("tsbtn_Disconnect.Image"))); 154 | this.tsbtn_Disconnect.ImageTransparentColor = System.Drawing.Color.Magenta; 155 | this.tsbtn_Disconnect.Name = "tsbtn_Disconnect"; 156 | this.tsbtn_Disconnect.Size = new System.Drawing.Size(93, 24); 157 | this.tsbtn_Disconnect.Text = "断开连接"; 158 | this.tsbtn_Disconnect.Click += new System.EventHandler(this.btn_Close_Click); 159 | // 160 | // tsbtn_Exit 161 | // 162 | this.tsbtn_Exit.Image = ((System.Drawing.Image)(resources.GetObject("tsbtn_Exit.Image"))); 163 | this.tsbtn_Exit.ImageTransparentColor = System.Drawing.Color.Magenta; 164 | this.tsbtn_Exit.Name = "tsbtn_Exit"; 165 | this.tsbtn_Exit.Size = new System.Drawing.Size(63, 24); 166 | this.tsbtn_Exit.Text = "退出"; 167 | this.tsbtn_Exit.Click += new System.EventHandler(this.MenuItem_Exit_Click); 168 | // 169 | // TabPage 170 | // 171 | this.TabPage.Controls.Add(this.tabPage1); 172 | this.TabPage.Controls.Add(this.tabPage2); 173 | this.TabPage.Controls.Add(this.tabPage3); 174 | this.TabPage.Dock = System.Windows.Forms.DockStyle.Fill; 175 | this.TabPage.Location = new System.Drawing.Point(0, 55); 176 | this.TabPage.Name = "TabPage"; 177 | this.TabPage.SelectedIndex = 0; 178 | this.TabPage.Size = new System.Drawing.Size(1016, 606); 179 | this.TabPage.TabIndex = 2; 180 | // 181 | // tabPage1 182 | // 183 | this.tabPage1.Controls.Add(this.btn_Close); 184 | this.tabPage1.Controls.Add(this.txt_DataBaseName); 185 | this.tabPage1.Controls.Add(this.lbl_Tips); 186 | this.tabPage1.Controls.Add(this.btn_SelectPath); 187 | this.tabPage1.Controls.Add(this.lbl_Path); 188 | this.tabPage1.Controls.Add(this.txt_Path); 189 | this.tabPage1.Controls.Add(this.lbl_NameSpace); 190 | this.tabPage1.Controls.Add(this.txt_NameSpace); 191 | this.tabPage1.Controls.Add(this.lbl_DataBaseName); 192 | this.tabPage1.Controls.Add(this.btn_Connect); 193 | this.tabPage1.Controls.Add(this.lbl_Pwd); 194 | this.tabPage1.Controls.Add(this.txt_Pwd); 195 | this.tabPage1.Controls.Add(this.lbl_UserName); 196 | this.tabPage1.Controls.Add(this.txt_UserName); 197 | this.tabPage1.Controls.Add(this.lbl_DataBaseType); 198 | this.tabPage1.Controls.Add(this.cbb_DataBaseType); 199 | this.tabPage1.Controls.Add(this.lbl_Ip); 200 | this.tabPage1.Controls.Add(this.txt_Ip); 201 | this.tabPage1.Location = new System.Drawing.Point(4, 25); 202 | this.tabPage1.Name = "tabPage1"; 203 | this.tabPage1.Padding = new System.Windows.Forms.Padding(3); 204 | this.tabPage1.Size = new System.Drawing.Size(1008, 577); 205 | this.tabPage1.TabIndex = 0; 206 | this.tabPage1.Text = "数据库连接"; 207 | this.tabPage1.UseVisualStyleBackColor = true; 208 | // 209 | // btn_Close 210 | // 211 | this.btn_Close.Anchor = System.Windows.Forms.AnchorStyles.None; 212 | this.btn_Close.Enabled = false; 213 | this.btn_Close.Location = new System.Drawing.Point(552, 436); 214 | this.btn_Close.Name = "btn_Close"; 215 | this.btn_Close.Size = new System.Drawing.Size(102, 38); 216 | this.btn_Close.TabIndex = 19; 217 | this.btn_Close.Text = "断开"; 218 | this.btn_Close.UseVisualStyleBackColor = true; 219 | this.btn_Close.Click += new System.EventHandler(this.btn_Close_Click); 220 | // 221 | // txt_DataBaseName 222 | // 223 | this.txt_DataBaseName.Anchor = System.Windows.Forms.AnchorStyles.None; 224 | this.txt_DataBaseName.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 225 | this.txt_DataBaseName.Location = new System.Drawing.Point(438, 267); 226 | this.txt_DataBaseName.Name = "txt_DataBaseName"; 227 | this.txt_DataBaseName.Size = new System.Drawing.Size(231, 31); 228 | this.txt_DataBaseName.TabIndex = 4; 229 | // 230 | // lbl_Tips 231 | // 232 | this.lbl_Tips.Anchor = System.Windows.Forms.AnchorStyles.None; 233 | this.lbl_Tips.AutoSize = true; 234 | this.lbl_Tips.Location = new System.Drawing.Point(688, 118); 235 | this.lbl_Tips.Name = "lbl_Tips"; 236 | this.lbl_Tips.Size = new System.Drawing.Size(142, 15); 237 | this.lbl_Tips.TabIndex = 17; 238 | this.lbl_Tips.TabStop = true; 239 | this.lbl_Tips.Text = "连接远程服务器注意"; 240 | this.lbl_Tips.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lbl_Tips_LinkClicked); 241 | // 242 | // btn_SelectPath 243 | // 244 | this.btn_SelectPath.Anchor = System.Windows.Forms.AnchorStyles.None; 245 | this.btn_SelectPath.Location = new System.Drawing.Point(691, 378); 246 | this.btn_SelectPath.Name = "btn_SelectPath"; 247 | this.btn_SelectPath.Size = new System.Drawing.Size(102, 28); 248 | this.btn_SelectPath.TabIndex = 16; 249 | this.btn_SelectPath.Text = "选择"; 250 | this.btn_SelectPath.UseVisualStyleBackColor = true; 251 | this.btn_SelectPath.Click += new System.EventHandler(this.btn_SelectPath_Click); 252 | // 253 | // lbl_Path 254 | // 255 | this.lbl_Path.Anchor = System.Windows.Forms.AnchorStyles.None; 256 | this.lbl_Path.AutoSize = true; 257 | this.lbl_Path.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 258 | this.lbl_Path.Location = new System.Drawing.Point(351, 385); 259 | this.lbl_Path.Name = "lbl_Path"; 260 | this.lbl_Path.Size = new System.Drawing.Size(73, 19); 261 | this.lbl_Path.TabIndex = 15; 262 | this.lbl_Path.Text = "生成路径:"; 263 | // 264 | // txt_Path 265 | // 266 | this.txt_Path.Anchor = System.Windows.Forms.AnchorStyles.None; 267 | this.txt_Path.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 268 | this.txt_Path.Location = new System.Drawing.Point(438, 378); 269 | this.txt_Path.Name = "txt_Path"; 270 | this.txt_Path.Size = new System.Drawing.Size(231, 31); 271 | this.txt_Path.TabIndex = 6; 272 | // 273 | // lbl_NameSpace 274 | // 275 | this.lbl_NameSpace.Anchor = System.Windows.Forms.AnchorStyles.None; 276 | this.lbl_NameSpace.AutoSize = true; 277 | this.lbl_NameSpace.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 278 | this.lbl_NameSpace.Location = new System.Drawing.Point(351, 328); 279 | this.lbl_NameSpace.Name = "lbl_NameSpace"; 280 | this.lbl_NameSpace.Size = new System.Drawing.Size(73, 19); 281 | this.lbl_NameSpace.TabIndex = 13; 282 | this.lbl_NameSpace.Text = "命名空间:"; 283 | // 284 | // txt_NameSpace 285 | // 286 | this.txt_NameSpace.Anchor = System.Windows.Forms.AnchorStyles.None; 287 | this.txt_NameSpace.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 288 | this.txt_NameSpace.Location = new System.Drawing.Point(438, 321); 289 | this.txt_NameSpace.Name = "txt_NameSpace"; 290 | this.txt_NameSpace.Size = new System.Drawing.Size(231, 31); 291 | this.txt_NameSpace.TabIndex = 5; 292 | // 293 | // lbl_DataBaseName 294 | // 295 | this.lbl_DataBaseName.Anchor = System.Windows.Forms.AnchorStyles.None; 296 | this.lbl_DataBaseName.AutoSize = true; 297 | this.lbl_DataBaseName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 298 | this.lbl_DataBaseName.Location = new System.Drawing.Point(337, 274); 299 | this.lbl_DataBaseName.Name = "lbl_DataBaseName"; 300 | this.lbl_DataBaseName.Size = new System.Drawing.Size(88, 19); 301 | this.lbl_DataBaseName.TabIndex = 10; 302 | this.lbl_DataBaseName.Text = "数据库名称:"; 303 | // 304 | // btn_Connect 305 | // 306 | this.btn_Connect.Anchor = System.Windows.Forms.AnchorStyles.None; 307 | this.btn_Connect.Location = new System.Drawing.Point(370, 436); 308 | this.btn_Connect.Name = "btn_Connect"; 309 | this.btn_Connect.Size = new System.Drawing.Size(102, 38); 310 | this.btn_Connect.TabIndex = 8; 311 | this.btn_Connect.Text = "连接"; 312 | this.btn_Connect.UseVisualStyleBackColor = true; 313 | this.btn_Connect.Click += new System.EventHandler(this.btn_Connect_Click); 314 | // 315 | // lbl_Pwd 316 | // 317 | this.lbl_Pwd.Anchor = System.Windows.Forms.AnchorStyles.None; 318 | this.lbl_Pwd.AutoSize = true; 319 | this.lbl_Pwd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 320 | this.lbl_Pwd.Location = new System.Drawing.Point(366, 223); 321 | this.lbl_Pwd.Name = "lbl_Pwd"; 322 | this.lbl_Pwd.Size = new System.Drawing.Size(59, 19); 323 | this.lbl_Pwd.TabIndex = 7; 324 | this.lbl_Pwd.Text = "密 码:"; 325 | // 326 | // txt_Pwd 327 | // 328 | this.txt_Pwd.Anchor = System.Windows.Forms.AnchorStyles.None; 329 | this.txt_Pwd.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 330 | this.txt_Pwd.Location = new System.Drawing.Point(438, 216); 331 | this.txt_Pwd.Name = "txt_Pwd"; 332 | this.txt_Pwd.PasswordChar = '*'; 333 | this.txt_Pwd.Size = new System.Drawing.Size(231, 31); 334 | this.txt_Pwd.TabIndex = 3; 335 | // 336 | // lbl_UserName 337 | // 338 | this.lbl_UserName.Anchor = System.Windows.Forms.AnchorStyles.None; 339 | this.lbl_UserName.AutoSize = true; 340 | this.lbl_UserName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 341 | this.lbl_UserName.Location = new System.Drawing.Point(366, 170); 342 | this.lbl_UserName.Name = "lbl_UserName"; 343 | this.lbl_UserName.Size = new System.Drawing.Size(58, 19); 344 | this.lbl_UserName.TabIndex = 5; 345 | this.lbl_UserName.Text = "用户名:"; 346 | // 347 | // txt_UserName 348 | // 349 | this.txt_UserName.Anchor = System.Windows.Forms.AnchorStyles.None; 350 | this.txt_UserName.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 351 | this.txt_UserName.Location = new System.Drawing.Point(438, 163); 352 | this.txt_UserName.Name = "txt_UserName"; 353 | this.txt_UserName.Size = new System.Drawing.Size(231, 31); 354 | this.txt_UserName.TabIndex = 2; 355 | // 356 | // lbl_DataBaseType 357 | // 358 | this.lbl_DataBaseType.Anchor = System.Windows.Forms.AnchorStyles.None; 359 | this.lbl_DataBaseType.AutoSize = true; 360 | this.lbl_DataBaseType.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 361 | this.lbl_DataBaseType.Location = new System.Drawing.Point(336, 62); 362 | this.lbl_DataBaseType.Name = "lbl_DataBaseType"; 363 | this.lbl_DataBaseType.Size = new System.Drawing.Size(88, 19); 364 | this.lbl_DataBaseType.TabIndex = 3; 365 | this.lbl_DataBaseType.Text = "数据库类型:"; 366 | // 367 | // cbb_DataBaseType 368 | // 369 | this.cbb_DataBaseType.Anchor = System.Windows.Forms.AnchorStyles.None; 370 | this.cbb_DataBaseType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 371 | this.cbb_DataBaseType.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 372 | this.cbb_DataBaseType.FormattingEnabled = true; 373 | this.cbb_DataBaseType.Location = new System.Drawing.Point(438, 55); 374 | this.cbb_DataBaseType.Name = "cbb_DataBaseType"; 375 | this.cbb_DataBaseType.Size = new System.Drawing.Size(231, 32); 376 | this.cbb_DataBaseType.TabIndex = 0; 377 | // 378 | // lbl_Ip 379 | // 380 | this.lbl_Ip.Anchor = System.Windows.Forms.AnchorStyles.None; 381 | this.lbl_Ip.AutoSize = true; 382 | this.lbl_Ip.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 383 | this.lbl_Ip.Location = new System.Drawing.Point(366, 116); 384 | this.lbl_Ip.Name = "lbl_Ip"; 385 | this.lbl_Ip.Size = new System.Drawing.Size(58, 19); 386 | this.lbl_Ip.TabIndex = 1; 387 | this.lbl_Ip.Text = "IP地址:"; 388 | // 389 | // txt_Ip 390 | // 391 | this.txt_Ip.Anchor = System.Windows.Forms.AnchorStyles.None; 392 | this.txt_Ip.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 393 | this.txt_Ip.Location = new System.Drawing.Point(438, 109); 394 | this.txt_Ip.Name = "txt_Ip"; 395 | this.txt_Ip.Size = new System.Drawing.Size(231, 31); 396 | this.txt_Ip.TabIndex = 1; 397 | // 398 | // tabPage2 399 | // 400 | this.tabPage2.Controls.Add(this.lbl_Mode); 401 | this.tabPage2.Controls.Add(this.cbb_Mode); 402 | this.tabPage2.Controls.Add(this.lbl_TableName); 403 | this.tabPage2.Controls.Add(this.dgv_TableDetails); 404 | this.tabPage2.Controls.Add(this.btn_Read); 405 | this.tabPage2.Controls.Add(this.btn_Generate); 406 | this.tabPage2.Controls.Add(this.cbb_Tables); 407 | this.tabPage2.Location = new System.Drawing.Point(4, 25); 408 | this.tabPage2.Name = "tabPage2"; 409 | this.tabPage2.Padding = new System.Windows.Forms.Padding(3); 410 | this.tabPage2.Size = new System.Drawing.Size(1008, 577); 411 | this.tabPage2.TabIndex = 1; 412 | this.tabPage2.Text = "代码生成"; 413 | this.tabPage2.UseVisualStyleBackColor = true; 414 | // 415 | // lbl_Mode 416 | // 417 | this.lbl_Mode.Anchor = System.Windows.Forms.AnchorStyles.None; 418 | this.lbl_Mode.AutoSize = true; 419 | this.lbl_Mode.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 420 | this.lbl_Mode.Location = new System.Drawing.Point(567, 31); 421 | this.lbl_Mode.Name = "lbl_Mode"; 422 | this.lbl_Mode.Size = new System.Drawing.Size(43, 19); 423 | this.lbl_Mode.TabIndex = 14; 424 | this.lbl_Mode.Text = "表名:"; 425 | // 426 | // cbb_Mode 427 | // 428 | this.cbb_Mode.Anchor = System.Windows.Forms.AnchorStyles.None; 429 | this.cbb_Mode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 430 | this.cbb_Mode.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 431 | this.cbb_Mode.FormattingEnabled = true; 432 | this.cbb_Mode.Location = new System.Drawing.Point(617, 24); 433 | this.cbb_Mode.Name = "cbb_Mode"; 434 | this.cbb_Mode.Size = new System.Drawing.Size(193, 32); 435 | this.cbb_Mode.TabIndex = 13; 436 | // 437 | // lbl_TableName 438 | // 439 | this.lbl_TableName.Anchor = System.Windows.Forms.AnchorStyles.None; 440 | this.lbl_TableName.AutoSize = true; 441 | this.lbl_TableName.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 442 | this.lbl_TableName.Location = new System.Drawing.Point(83, 31); 443 | this.lbl_TableName.Name = "lbl_TableName"; 444 | this.lbl_TableName.Size = new System.Drawing.Size(43, 19); 445 | this.lbl_TableName.TabIndex = 12; 446 | this.lbl_TableName.Text = "表名:"; 447 | // 448 | // dgv_TableDetails 449 | // 450 | this.dgv_TableDetails.AllowUserToAddRows = false; 451 | this.dgv_TableDetails.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 452 | this.dgv_TableDetails.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 453 | this.Number, 454 | this.FieldName, 455 | this.FieldDescribe, 456 | this.FieldType, 457 | this.FieldLength, 458 | this.IsPrimaryKey, 459 | this.IsNull, 460 | this.FieldDefaultValue}); 461 | this.dgv_TableDetails.Dock = System.Windows.Forms.DockStyle.Bottom; 462 | this.dgv_TableDetails.Location = new System.Drawing.Point(3, 74); 463 | this.dgv_TableDetails.Name = "dgv_TableDetails"; 464 | this.dgv_TableDetails.ReadOnly = true; 465 | this.dgv_TableDetails.RowTemplate.Height = 27; 466 | this.dgv_TableDetails.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; 467 | this.dgv_TableDetails.Size = new System.Drawing.Size(1002, 500); 468 | this.dgv_TableDetails.TabIndex = 11; 469 | // 470 | // Number 471 | // 472 | this.Number.DataPropertyName = "序号"; 473 | dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 474 | this.Number.DefaultCellStyle = dataGridViewCellStyle1; 475 | this.Number.HeaderText = "序号"; 476 | this.Number.Name = "Number"; 477 | this.Number.ReadOnly = true; 478 | // 479 | // FieldName 480 | // 481 | this.FieldName.DataPropertyName = "字段名称"; 482 | this.FieldName.FillWeight = 82.47158F; 483 | this.FieldName.HeaderText = "字段名称"; 484 | this.FieldName.Name = "FieldName"; 485 | this.FieldName.ReadOnly = true; 486 | this.FieldName.Width = 150; 487 | // 488 | // FieldDescribe 489 | // 490 | this.FieldDescribe.DataPropertyName = "字段说明"; 491 | this.FieldDescribe.FillWeight = 84.77386F; 492 | this.FieldDescribe.HeaderText = "字段说明"; 493 | this.FieldDescribe.Name = "FieldDescribe"; 494 | this.FieldDescribe.ReadOnly = true; 495 | this.FieldDescribe.Width = 154; 496 | // 497 | // FieldType 498 | // 499 | this.FieldType.DataPropertyName = "字段类型"; 500 | this.FieldType.FillWeight = 66.55966F; 501 | this.FieldType.HeaderText = "字段类型"; 502 | this.FieldType.MinimumWidth = 80; 503 | this.FieldType.Name = "FieldType"; 504 | this.FieldType.ReadOnly = true; 505 | this.FieldType.Width = 121; 506 | // 507 | // FieldLength 508 | // 509 | this.FieldLength.DataPropertyName = "字段长度"; 510 | dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 511 | this.FieldLength.DefaultCellStyle = dataGridViewCellStyle2; 512 | this.FieldLength.FillWeight = 59.03904F; 513 | this.FieldLength.HeaderText = "字段长度"; 514 | this.FieldLength.MinimumWidth = 80; 515 | this.FieldLength.Name = "FieldLength"; 516 | this.FieldLength.ReadOnly = true; 517 | this.FieldLength.Width = 108; 518 | // 519 | // IsPrimaryKey 520 | // 521 | this.IsPrimaryKey.DataPropertyName = "是否主键"; 522 | dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 523 | this.IsPrimaryKey.DefaultCellStyle = dataGridViewCellStyle3; 524 | this.IsPrimaryKey.FillWeight = 52.45149F; 525 | this.IsPrimaryKey.HeaderText = "是否主键"; 526 | this.IsPrimaryKey.MinimumWidth = 80; 527 | this.IsPrimaryKey.Name = "IsPrimaryKey"; 528 | this.IsPrimaryKey.ReadOnly = true; 529 | this.IsPrimaryKey.Width = 108; 530 | // 531 | // IsNull 532 | // 533 | this.IsNull.DataPropertyName = "能否为空"; 534 | dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 535 | this.IsNull.DefaultCellStyle = dataGridViewCellStyle4; 536 | this.IsNull.FillWeight = 51.17035F; 537 | this.IsNull.HeaderText = "能否为空"; 538 | this.IsNull.MinimumWidth = 80; 539 | this.IsNull.Name = "IsNull"; 540 | this.IsNull.ReadOnly = true; 541 | this.IsNull.Width = 108; 542 | // 543 | // FieldDefaultValue 544 | // 545 | this.FieldDefaultValue.DataPropertyName = "默认值"; 546 | this.FieldDefaultValue.FillWeight = 46.68127F; 547 | this.FieldDefaultValue.HeaderText = "默认值"; 548 | this.FieldDefaultValue.Name = "FieldDefaultValue"; 549 | this.FieldDefaultValue.ReadOnly = true; 550 | this.FieldDefaultValue.Width = 108; 551 | // 552 | // btn_Read 553 | // 554 | this.btn_Read.Anchor = System.Windows.Forms.AnchorStyles.None; 555 | this.btn_Read.Location = new System.Drawing.Point(459, 21); 556 | this.btn_Read.Name = "btn_Read"; 557 | this.btn_Read.Size = new System.Drawing.Size(102, 38); 558 | this.btn_Read.TabIndex = 10; 559 | this.btn_Read.Text = "读取"; 560 | this.btn_Read.UseVisualStyleBackColor = true; 561 | this.btn_Read.Click += new System.EventHandler(this.btn_Read_Click); 562 | // 563 | // btn_Generate 564 | // 565 | this.btn_Generate.Anchor = System.Windows.Forms.AnchorStyles.None; 566 | this.btn_Generate.Location = new System.Drawing.Point(816, 21); 567 | this.btn_Generate.Name = "btn_Generate"; 568 | this.btn_Generate.Size = new System.Drawing.Size(102, 38); 569 | this.btn_Generate.TabIndex = 9; 570 | this.btn_Generate.Tag = ""; 571 | this.btn_Generate.Text = "生成"; 572 | this.btn_Generate.UseVisualStyleBackColor = true; 573 | this.btn_Generate.Click += new System.EventHandler(this.btn_Generate_Click); 574 | // 575 | // cbb_Tables 576 | // 577 | this.cbb_Tables.Anchor = System.Windows.Forms.AnchorStyles.None; 578 | this.cbb_Tables.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; 579 | this.cbb_Tables.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); 580 | this.cbb_Tables.FormattingEnabled = true; 581 | this.cbb_Tables.Location = new System.Drawing.Point(132, 24); 582 | this.cbb_Tables.Name = "cbb_Tables"; 583 | this.cbb_Tables.Size = new System.Drawing.Size(321, 32); 584 | this.cbb_Tables.TabIndex = 3; 585 | // 586 | // tabPage3 587 | // 588 | this.tabPage3.Controls.Add(this.txt_Msg); 589 | this.tabPage3.Location = new System.Drawing.Point(4, 25); 590 | this.tabPage3.Name = "tabPage3"; 591 | this.tabPage3.Padding = new System.Windows.Forms.Padding(3); 592 | this.tabPage3.Size = new System.Drawing.Size(1008, 577); 593 | this.tabPage3.TabIndex = 2; 594 | this.tabPage3.Text = "日志"; 595 | this.tabPage3.UseVisualStyleBackColor = true; 596 | // 597 | // txt_Msg 598 | // 599 | this.txt_Msg.Dock = System.Windows.Forms.DockStyle.Fill; 600 | this.txt_Msg.Location = new System.Drawing.Point(3, 3); 601 | this.txt_Msg.Multiline = true; 602 | this.txt_Msg.Name = "txt_Msg"; 603 | this.txt_Msg.Size = new System.Drawing.Size(1002, 571); 604 | this.txt_Msg.TabIndex = 0; 605 | // 606 | // contextMenuStrip1 607 | // 608 | this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); 609 | this.contextMenuStrip1.Name = "contextMenuStrip1"; 610 | this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4); 611 | // 612 | // MainForm 613 | // 614 | this.AcceptButton = this.btn_Connect; 615 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); 616 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 617 | this.ClientSize = new System.Drawing.Size(1016, 661); 618 | this.Controls.Add(this.TabPage); 619 | this.Controls.Add(this.toolStrip1); 620 | this.Controls.Add(this.MainMenuStrip); 621 | this.Name = "MainForm"; 622 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 623 | this.Text = "代码生成工具"; 624 | this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); 625 | this.Load += new System.EventHandler(this.MainForm_Load); 626 | this.MainMenuStrip.ResumeLayout(false); 627 | this.MainMenuStrip.PerformLayout(); 628 | this.toolStrip1.ResumeLayout(false); 629 | this.toolStrip1.PerformLayout(); 630 | this.TabPage.ResumeLayout(false); 631 | this.tabPage1.ResumeLayout(false); 632 | this.tabPage1.PerformLayout(); 633 | this.tabPage2.ResumeLayout(false); 634 | this.tabPage2.PerformLayout(); 635 | ((System.ComponentModel.ISupportInitialize)(this.dgv_TableDetails)).EndInit(); 636 | this.tabPage3.ResumeLayout(false); 637 | this.tabPage3.PerformLayout(); 638 | this.ResumeLayout(false); 639 | this.PerformLayout(); 640 | 641 | } 642 | 643 | #endregion 644 | 645 | private System.Windows.Forms.MenuStrip MainMenuStrip; 646 | private System.Windows.Forms.ToolStripMenuItem 菜单ToolStripMenuItem; 647 | private System.Windows.Forms.ToolStripMenuItem MenuItem_Exit; 648 | private System.Windows.Forms.ToolStrip toolStrip1; 649 | private System.Windows.Forms.TabControl TabPage; 650 | private System.Windows.Forms.TabPage tabPage1; 651 | private System.Windows.Forms.TabPage tabPage2; 652 | private System.Windows.Forms.ToolStripButton tsbtn_Connect; 653 | private System.Windows.Forms.Label lbl_DataBaseType; 654 | private System.Windows.Forms.ComboBox cbb_DataBaseType; 655 | private System.Windows.Forms.Label lbl_Ip; 656 | private System.Windows.Forms.TextBox txt_Ip; 657 | private System.Windows.Forms.ToolStripMenuItem MenuItem_Help; 658 | private System.Windows.Forms.TabPage tabPage3; 659 | private System.Windows.Forms.TextBox txt_Msg; 660 | private System.Windows.Forms.Label lbl_UserName; 661 | private System.Windows.Forms.TextBox txt_UserName; 662 | private System.Windows.Forms.Label lbl_Pwd; 663 | private System.Windows.Forms.TextBox txt_Pwd; 664 | private System.Windows.Forms.Button btn_Connect; 665 | private System.Windows.Forms.Label lbl_DataBaseName; 666 | private System.Windows.Forms.Label lbl_NameSpace; 667 | private System.Windows.Forms.TextBox txt_NameSpace; 668 | private System.Windows.Forms.Label lbl_Path; 669 | private System.Windows.Forms.TextBox txt_Path; 670 | private System.Windows.Forms.Button btn_SelectPath; 671 | private System.Windows.Forms.LinkLabel lbl_Tips; 672 | private System.Windows.Forms.TextBox txt_DataBaseName; 673 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; 674 | private System.Windows.Forms.ComboBox cbb_Tables; 675 | private System.Windows.Forms.Button btn_Read; 676 | private System.Windows.Forms.Button btn_Generate; 677 | private System.Windows.Forms.DataGridView dgv_TableDetails; 678 | private System.Windows.Forms.Label lbl_TableName; 679 | private System.Windows.Forms.ComboBox cbb_Mode; 680 | private System.Windows.Forms.Button btn_Close; 681 | private System.Windows.Forms.Label lbl_Mode; 682 | private System.Windows.Forms.DataGridViewTextBoxColumn Number; 683 | private System.Windows.Forms.DataGridViewTextBoxColumn FieldName; 684 | private System.Windows.Forms.DataGridViewTextBoxColumn FieldDescribe; 685 | private System.Windows.Forms.DataGridViewTextBoxColumn FieldType; 686 | private System.Windows.Forms.DataGridViewTextBoxColumn FieldLength; 687 | private System.Windows.Forms.DataGridViewTextBoxColumn IsPrimaryKey; 688 | private System.Windows.Forms.DataGridViewTextBoxColumn IsNull; 689 | private System.Windows.Forms.DataGridViewTextBoxColumn FieldDefaultValue; 690 | private System.Windows.Forms.ToolStripButton tsbtn_Disconnect; 691 | private System.Windows.Forms.ToolStripButton tsbtn_Exit; 692 | } 693 | } -------------------------------------------------------------------------------- /CodeAutogenerationTool/MForm/MainForm.cs: -------------------------------------------------------------------------------- 1 | using CodeAutogenerationTool.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Data; 5 | using System.Data.SqlClient; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading; 10 | using System.Windows.Forms; 11 | using System.Xml.Linq; 12 | using CodeAutogenerationTool.Helper; 13 | using EasyFramework.Models; 14 | using EasyFramework.Attr; 15 | 16 | namespace CodeAutogenerationTool.MForm 17 | { 18 | public partial class MainForm : Form 19 | { 20 | #region 全局属性定义 21 | 22 | List dataBaseTypeItems = new List() 23 | { 24 | new ListItem(){ Text = "Microsoft SQL Server", Value = "0" } 25 | };//数据库类型 26 | string configPath = "CodeAutogenerationTool.xml";//配置文件路径 27 | string connStr = "";//数据库连接字符串 28 | SqlConnection conn = null;//数据库连接 29 | delegate void connDelegate();//主线程委托 30 | 31 | #endregion 32 | 33 | public MainForm() 34 | { 35 | InitializeComponent(); 36 | } 37 | 38 | //窗体加载事件 39 | private void MainForm_Load(object sender, EventArgs e) 40 | { 41 | //数据库类型添加 42 | foreach (var item in dataBaseTypeItems) 43 | { 44 | cbb_DataBaseType.Items.Add(item); 45 | } 46 | cbb_DataBaseType.SelectedIndex = 0; 47 | 48 | //加载保存过的数据 49 | LoadConfiguration(); 50 | 51 | //代码生成项赋值 52 | cbb_Mode.Items.Add(new ListItem() { Text = "生成MVC中的MC", Value = "MC" }); 53 | cbb_Mode.Items.Add(new ListItem() { Text = "生成三层中的DAL", Value = "DAL" }); 54 | cbb_Mode.Items.Add(new ListItem() { Text = "生成Model", Value = "Model" }); 55 | cbb_Mode.SelectedIndex = 0; 56 | } 57 | 58 | //选择生成路径按钮 59 | private void btn_SelectPath_Click(object sender, EventArgs e) 60 | { 61 | FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); 62 | if (folderBrowserDialog.ShowDialog() == DialogResult.OK) 63 | { 64 | txt_Path.Text = folderBrowserDialog.SelectedPath; 65 | } 66 | } 67 | 68 | //连接至数据库 69 | private void btn_Connect_Click(object sender, EventArgs e) 70 | { 71 | //保存配置文件 72 | if(string.IsNullOrEmpty(txt_Ip.Text) || string.IsNullOrEmpty(txt_UserName.Text)|| string.IsNullOrEmpty(txt_Pwd.Text)|| string.IsNullOrEmpty(txt_DataBaseName.Text)|| string.IsNullOrEmpty(txt_NameSpace.Text)|| string.IsNullOrEmpty(txt_Path.Text)) 73 | { 74 | MessageBox.Show("关键信息不能为空"); 75 | return; 76 | } 77 | Thread thread = new Thread(ConnectionDataBase); 78 | string[] config = new string[] { cbb_DataBaseType.Text, txt_Ip.Text, txt_UserName.Text, txt_Pwd.Text, txt_DataBaseName.Text, txt_NameSpace.Text, txt_Path.Text }; 79 | IsConfigExist(true, config); 80 | btn_Connect.Enabled = false; 81 | tsbtn_Connect.Enabled = false; 82 | tsbtn_Disconnect.Enabled = true; 83 | btn_Connect.Text = "连接中..."; 84 | thread.Start(); 85 | } 86 | 87 | //连接远程服务器注意提醒 88 | private void lbl_Tips_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 89 | { 90 | MessageBox.Show("1.需要在数据库配置中打开TCP/IP协议, 端口如果不是1433则在填写ip地址中加入端口号例如:XXX.XXX.XXX.XXX,端口号\n2.数据库需要允许远程连接\n3.用户名访问数据库权限\n4.如连接失败请查看日志"); 91 | } 92 | 93 | //断开数据库连接 94 | private void btn_Close_Click(object sender, EventArgs e) 95 | { 96 | cbb_DataBaseType.Enabled = true; 97 | txt_Ip.Enabled = true; 98 | txt_NameSpace.Enabled = true; 99 | txt_Path.Enabled = true; 100 | txt_Pwd.Enabled = true; 101 | txt_UserName.Enabled = true; 102 | btn_Connect.Enabled = true; 103 | conn.Close(); 104 | btn_Connect.Text = "连接"; 105 | btn_Close.Enabled = false; 106 | txt_DataBaseName.Enabled = true; 107 | btn_SelectPath.Enabled = true; 108 | cbb_Tables.DataSource = null; 109 | dgv_TableDetails.DataSource = null; 110 | tsbtn_Connect.Enabled = true; 111 | tsbtn_Disconnect.Enabled = false; 112 | txt_Msg.Text += DateTime.Now + " 断开连接\r\n"; 113 | } 114 | 115 | //读取表的信息 116 | private void btn_Read_Click(object sender, EventArgs e) 117 | { 118 | if (conn != null && conn.State == ConnectionState.Open) 119 | { 120 | if (string.IsNullOrEmpty(cbb_Tables.Text)) 121 | { 122 | MessageBox.Show("请先选择需要读取的数据表!"); 123 | return; 124 | } 125 | //查询表信息sql语句 126 | string sqlStr = string.Format(@"SELECT col.colorder AS 序号 , 127 | col.name AS 字段名称 , 128 | ISNULL(ep.[value], '') AS 字段说明 , 129 | t.name AS 字段类型 , 130 | col.length AS 字段长度 , 131 | CASE WHEN EXISTS ( SELECT 1 132 | FROM dbo.sysindexes si 133 | INNER JOIN dbo.sysindexkeys sik ON si.id = sik.id 134 | AND si.indid = sik.indid 135 | INNER JOIN dbo.syscolumns sc ON sc.id = sik.id 136 | AND sc.colid = sik.colid 137 | INNER JOIN dbo.sysobjects so ON so.name = si.name 138 | AND so.xtype = 'PK' 139 | WHERE sc.id = col.id 140 | AND sc.colid = col.colid ) THEN '√' ELSE '' END AS 是否主键 , 141 | CASE WHEN col.isnullable = 1 THEN '√' ELSE '' END AS 能否为空 , 142 | ISNULL(comm.text, '') AS 默认值 143 | FROM dbo.syscolumns col 144 | LEFT JOIN dbo.systypes t ON col.xtype = t.xusertype 145 | inner JOIN dbo.sysobjects obj ON col.id = obj.id 146 | AND obj.xtype = 'U' 147 | AND obj.status >= 0 148 | LEFT JOIN dbo.syscomments comm ON col.cdefault = comm.id 149 | LEFT JOIN sys.extended_properties ep ON col.id = ep.major_id 150 | AND col.colid = ep.minor_id 151 | AND ep.name = 'MS_Description' 152 | LEFT JOIN sys.extended_properties epTwo ON obj.id = epTwo.major_id 153 | AND epTwo.minor_id = 0 154 | AND epTwo.name = 'MS_Description' 155 | WHERE obj.name = '{0}' 156 | ORDER BY col.colorder ;", cbb_Tables.Text); 157 | SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlStr, conn); 158 | DataTable dt = new DataTable(); 159 | dataAdapter.Fill(dt); 160 | dataAdapter.Dispose(); 161 | dgv_TableDetails.DataSource = dt; 162 | } 163 | else 164 | { 165 | MessageBox.Show("与数据库断开连接, 请尝试断开重新连接!"); 166 | } 167 | } 168 | 169 | //生成代码 170 | private void btn_Generate_Click(object sender, EventArgs e) 171 | { 172 | if (dgv_TableDetails.Rows.Count < 1) 173 | { 174 | //读取字段为0 175 | MessageBox.Show("没有数据能够生成"); 176 | } 177 | else if (conn == null || conn.State != ConnectionState.Open) 178 | { 179 | //数据库连接关闭或异常 180 | MessageBox.Show("与数据库的连接已经断开, 请尝试断开后重新连接"); 181 | } 182 | else 183 | { 184 | MSSqlAutoGenerationHelper.path = txt_Path.Text.Trim(); 185 | MSSqlAutoGenerationHelper.nameSpace = txt_NameSpace.Text.Trim(); 186 | 187 | //代码生成 188 | #region 生成主要代码 189 | //表信息 190 | ModelAttribute modelAttribute = new ModelAttribute() 191 | { 192 | TableName = cbb_Tables.Text 193 | }; 194 | //该模型字段信息 195 | List modelProperties = new List(); 196 | foreach (DataGridViewRow row in dgv_TableDetails.Rows) 197 | { 198 | if (string.IsNullOrEmpty(modelAttribute.PrimaryKey) && !string.IsNullOrEmpty(row.Cells["IsPrimaryKey"].Value.ToString())) 199 | { 200 | modelAttribute.PrimaryKey = row.Cells["FieldName"].Value.ToString();//表主键 201 | } 202 | //字段信息 203 | ModelProperty modelProperty = new ModelProperty() 204 | { 205 | ColName = row.Cells["FieldName"].Value.ToString(), 206 | ColType = row.Cells["FieldType"].Value.ToString(), 207 | Default = row.Cells["FieldDefaultValue"].Value.ToString(), 208 | Explain = row.Cells["FieldDescribe"].Value.ToString(), 209 | IsNull = string.IsNullOrEmpty(row.Cells["IsNull"].Value.ToString()), 210 | MinLength = 0, 211 | MaxLength = Convert.ToInt32(row.Cells["FieldLength"].Value.ToString()), 212 | }; 213 | modelProperties.Add(modelProperty); 214 | } 215 | #endregion 216 | 217 | switch ((cbb_Mode.SelectedItem as ListItem).Value) 218 | { 219 | case "MC": 220 | //生成MVC模式中的Model和Controller 221 | //生成的路径 222 | string path = txt_Path.Text; 223 | //判断Controllers文件夹是否存在 224 | if (!Directory.Exists(path + "/Controllers")) 225 | { 226 | //不存在则创建 一般来说创建MVC项目时会有 227 | Directory.CreateDirectory(path + "/Controllers"); 228 | } 229 | //判断Models文件夹是否存在 230 | if (!Directory.Exists(path + "/Models")) 231 | { 232 | // 不存在则创建 233 | Directory.CreateDirectory(path + "/Models"); 234 | } 235 | 236 | //调用生成方法生成MC 237 | if (MSSqlAutoGenerationHelper.GenerateMC(modelProperties, modelAttribute)) 238 | { 239 | txt_Msg.Text += "成功生成" + cbb_Mode.Text + ", 数据库表名:" + cbb_Tables.Text + ";\r\n"; 240 | MessageBox.Show("生成成功"); 241 | } 242 | break; 243 | case "DAL": 244 | //生成普通三成架构中的DAL 245 | MessageBox.Show("生成DAL"); 246 | break; 247 | case "Model": 248 | //只生成Model 249 | //判断Models文件夹是否存在 250 | if (!Directory.Exists(txt_Path.Text + "/Models")) 251 | { 252 | // 不存在则创建 253 | Directory.CreateDirectory(txt_Path.Text + "/Models"); 254 | } 255 | if (MSSqlAutoGenerationHelper.GenerateModel(modelProperties, modelAttribute)) 256 | { 257 | txt_Msg.Text += "成功生成" + cbb_Mode.Text + ", 数据库表名:" + cbb_Tables.Text + ";\r\n"; 258 | MessageBox.Show("生成成功"); 259 | } 260 | break; 261 | } 262 | 263 | //代码生成配置文件(数据库连接信息等) 264 | if (!Directory.Exists(txt_Path.Text + "/bin")) 265 | { 266 | //创建bin文件夹 267 | Directory.CreateDirectory(txt_Path.Text + "/bin"); 268 | } 269 | GenerateConfigFile(); 270 | } 271 | } 272 | 273 | //退出 274 | private void MenuItem_Exit_Click(object sender, EventArgs e) 275 | { 276 | if (conn != null && conn.State == ConnectionState.Open) 277 | { 278 | conn.Close(); 279 | } 280 | Application.Exit(); 281 | } 282 | 283 | //退出 284 | private void MainForm_FormClosing(object sender, FormClosingEventArgs e) 285 | { 286 | if (MessageBox.Show("是否退出?", "提醒", MessageBoxButtons.OKCancel) == DialogResult.OK) 287 | { 288 | if (conn != null && conn.State == ConnectionState.Open) 289 | { 290 | conn.Close(); 291 | } 292 | } 293 | else 294 | { 295 | e.Cancel = true; 296 | } 297 | } 298 | 299 | #region 菜单事件 300 | 301 | //帮助 302 | private void MenuItem_Help_Click(object sender, EventArgs e) 303 | { 304 | string msg = "1.选择数据库类型 \n2.输入数据库所在IP地址及登录用户名和密码(如是本机则一般为127.0.0.1), 连接\n3.连接失败请查看日志, 连接成功选择对应需要生成代码的数据库,确定"; 305 | 306 | MessageBox.Show(msg); 307 | } 308 | 309 | #endregion 310 | 311 | #region 自定义方法 312 | 313 | /// 314 | /// 加载软件配置文件 315 | /// 316 | private void LoadConfiguration() 317 | { 318 | try 319 | { 320 | //验证配置文件是否存在 321 | IsConfigExist(false); 322 | XDocument xml = XDocument.Load(configPath); 323 | XElement root = xml.Root;//获取xml根元素 324 | IEnumerable elements = root.Element("appSettings").Elements("add"); 325 | foreach (var item in elements) 326 | { 327 | switch (item.Attribute("key").Value) 328 | { 329 | case "Server.Type": 330 | if (dataBaseTypeItems.Where(p => p.Text == item.Attribute("value").Value).Count() > 0) 331 | cbb_DataBaseType.SelectedItem = dataBaseTypeItems.Single(p => p.Text == item.Attribute("value").Value); 332 | break; 333 | case "Server.Ip": 334 | txt_Ip.Text = item.Attribute("value").Value; 335 | break; 336 | case "Server.UserName": 337 | txt_UserName.Text = item.Attribute("value").Value; 338 | break; 339 | case "Server.Pwd": 340 | txt_Pwd.Text = item.Attribute("value").Value; 341 | break; 342 | case "Server.NameSpace": 343 | txt_NameSpace.Text = item.Attribute("value").Value; 344 | break; 345 | case "Server.Path": 346 | txt_Path.Text = item.Attribute("value").Value; 347 | break; 348 | case "Server.DataBaseName": 349 | txt_DataBaseName.Text = item.Attribute("value").Value; 350 | break; 351 | } 352 | } 353 | } 354 | catch (Exception e) 355 | { 356 | //验证配置文件是否存在 357 | IsConfigExist(true); 358 | } 359 | } 360 | 361 | /// 362 | /// 判断软件配置文件是否存在或保存配置文件 363 | /// 364 | /// 为true则重置文件内容 365 | /// 可选参数, 为配置文件里的value值, 需要长度为6的数组 366 | private void IsConfigExist(bool isReset, params string[] config) 367 | { 368 | try 369 | { 370 | if (config.Length < 7) 371 | { 372 | config = new string[] { "", "", "", "", "", "", "" }; 373 | } 374 | if (!File.Exists(configPath) || isReset) 375 | { 376 | FileStream fileStream = new FileStream("CodeAutogenerationTool.xml", FileMode.Create); 377 | string configStr = string.Format("\n\n \n \n \n \n \n \n \n \n \n", config); 378 | byte[] array = Encoding.Default.GetBytes(configStr); 379 | fileStream.Write(array, 0, array.Length); 380 | fileStream.Close(); 381 | } 382 | } 383 | catch (Exception e) 384 | { 385 | MessageBox.Show("生成配置文件出错, 请查看日志!"); 386 | txt_Msg.Text += e.Message + "\r\n"; 387 | } 388 | 389 | } 390 | 391 | /// 392 | /// 连接数据库 393 | /// 394 | private void ConnectionDataBase() 395 | { 396 | try 397 | { 398 | string dataBaseType = ""; 399 | if (cbb_DataBaseType.InvokeRequired) 400 | { 401 | connDelegate cd = new connDelegate(() => 402 | { 403 | dataBaseType = (cbb_DataBaseType.SelectedItem as ListItem).Value; 404 | }); 405 | Invoke(cd); 406 | } 407 | switch (dataBaseType) 408 | { 409 | case "0": 410 | //MS SQL的数据库连接字符串 411 | connStr = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3};Connection Timeout=5", txt_Ip.Text, txt_DataBaseName.Text, txt_UserName.Text, txt_Pwd.Text); 412 | break; 413 | } 414 | conn = new SqlConnection(connStr); 415 | conn.Open();//打开数据库连接 416 | if (btn_Connect.InvokeRequired) 417 | { 418 | connDelegate cd = new connDelegate(ConnectionDelegate); 419 | Invoke(cd); 420 | } 421 | else 422 | { 423 | ConnectionDelegate(); 424 | } 425 | } 426 | catch (Exception e) 427 | { 428 | //数据库连接失败 从不是创建控件的线程 委托访问 429 | if (btn_Connect.InvokeRequired) 430 | { 431 | connDelegate cd = new connDelegate(() => 432 | { 433 | btn_Connect.Enabled = true; 434 | btn_Connect.Text = "重新连接"; 435 | txt_Msg.Text += e.Message + "\r\n"; 436 | }); 437 | Invoke(cd); 438 | } 439 | else 440 | { 441 | btn_Connect.Enabled = true; 442 | btn_Connect.Text = "重新连接"; 443 | txt_Msg.Text += e.Message + "\r\n"; 444 | } 445 | } 446 | } 447 | 448 | //该线程无法操作非该线程创建的控件, 使用委托修改指定线程创建的控件 449 | private void ConnectionDelegate() 450 | { 451 | //连接数据库成功 452 | if (conn.State == ConnectionState.Open) 453 | { 454 | cbb_DataBaseType.Enabled = false; 455 | txt_Ip.Enabled = false; 456 | txt_UserName.Enabled = false; 457 | txt_Pwd.Enabled = false; 458 | txt_DataBaseName.Enabled = false; 459 | txt_NameSpace.Enabled = false; 460 | txt_Path.Enabled = false; 461 | btn_Connect.Enabled = false; 462 | btn_Connect.Text = "连接成功"; 463 | btn_Close.Enabled = true; 464 | btn_SelectPath.Enabled = false; 465 | txt_Msg.Text += DateTime.Now + " 连接数据库成功\r\n"; 466 | MSSqlAutoGenerationHelper.path = txt_Path.Text;//生成代码路径 467 | MSSqlAutoGenerationHelper.nameSpace = txt_NameSpace.Text;//生成代码的命名空间 468 | 469 | #region 数据库中表名读取 470 | string[] restrictions = new string[4]; 471 | restrictions[3] = "BASE TABLE"; 472 | DataTable dt = conn.GetSchema("Tables", restrictions); 473 | List tables = new List(); 474 | foreach (DataRow row in dt.Rows) 475 | { 476 | tables.Add(row["TABLE_NAME"].ToString()); 477 | } 478 | tables.Sort(); 479 | cbb_Tables.DataSource = tables; 480 | #endregion 481 | } 482 | } 483 | 484 | /// 485 | /// 生成EasyFramework配置文件 486 | /// 487 | private void GenerateConfigFile() 488 | { 489 | try 490 | { 491 | if (File.Exists(txt_Path.Text + "/bin/EasyFramework.config")) 492 | { 493 | return; 494 | } 495 | else 496 | { 497 | //创建配置文件 498 | FileStream fileStream = new FileStream(txt_Path.Text + "/bin/EasyFramework.config", FileMode.Create); 499 | string configStr = string.Format("\n\n \n \n \n \n \n \n", txt_Ip.Text, txt_DataBaseName.Text, txt_UserName.Text, txt_Pwd.Text); 500 | //写入信息 501 | byte[] array = Encoding.Default.GetBytes(configStr); 502 | fileStream.Write(array, 0, array.Length); 503 | fileStream.Close(); 504 | } 505 | } 506 | catch (Exception e) 507 | { 508 | 509 | MessageBox.Show("生成配置文件出错, 请查看日志!"); 510 | txt_Msg.Text += e.Message + "\r\n"; 511 | } 512 | 513 | } 514 | 515 | #endregion 516 | } 517 | } 518 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/MForm/MainForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | 124 | 125 | 126 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 127 | JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAWJLR0T+0gDCUwAAAAd0SU1FB+MBCBcv 128 | Fyx2yowAAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMDEtMDhUMjM6NDc6MjMrMDg6MDDIO/ePAAAAJXRF 129 | WHRkYXRlOm1vZGlmeQAyMDE5LTAxLTA4VDIzOjQ3OjIzKzA4OjAwuWZPMwAAAEN0RVh0c29mdHdhcmUA 130 | L3Vzci9sb2NhbC9pbWFnZW1hZ2ljay9zaGFyZS9kb2MvSW1hZ2VNYWdpY2stNy8vaW5kZXguaHRtbL21 131 | eQoAAAAYdEVYdFRodW1iOjpEb2N1bWVudDo6UGFnZXMAMaf/uy8AAAAXdEVYdFRodW1iOjpJbWFnZTo6 132 | SGVpZ2h0ADMyKPT49AAAABZ0RVh0VGh1bWI6OkltYWdlOjpXaWR0aAAzMtBbOHkAAAAZdEVYdFRodW1i 133 | OjpNaW1ldHlwZQBpbWFnZS9wbmc/slZOAAAAF3RFWHRUaHVtYjo6TVRpbWUAMTU0Njk2MjQ0MyQyKOcA 134 | AAARdEVYdFRodW1iOjpTaXplADIyMzFCaDDxgwAAAF50RVh0VGh1bWI6OlVSSQBmaWxlOi8vL2hvbWUv 135 | d3d3cm9vdC9uZXdzaXRlL3d3dy5lYXN5aWNvbi5uZXQvY2RuLWltZy5lYXN5aWNvbi5jbi9maWxlcy8y 136 | LzI3MjQ0LnBuZwI2nv0AAAO4SURBVDhPbVJ5TBNWHP6JUyqSLFlIlhic0106ExoXjs1lU7dkDDksMJWI 137 | InIKcouc4RKQAkU5pQVt7UCQS8u6IshVeqwFoUCroxMsp1GzxYWYhqB/fHtV/9yXfHkv7/2+73e8Rzbs 138 | 8CqhTa4Z9PXJOqKNx+23exZzf4gSxfkmSvg2/hgtivvo52IubThm/03IVdrslkkfH+a/0dJObz5x3LOp 139 | tc9An/jwXUJz24TCDv28Qm1eG5mwYMQwjx6NeU3UNTp/Jq9d+KlvmUvH4DRxPLJppw8zec81ndr6p8kt 140 | uNqzXDpitImud08gsUKBEzkdOJnbiZTKXkgVk1BPLqCiSW30OFXr2T38J9m5pREdCBPSHn8B98pNtUnF 141 | ssWW/oZDMWJ4JTXheHYHgvO6EJjZhsPJzThf1Yc/jEuobtGa9gZWcA9FiFgPW4M5sZfuNNrcz5Z048BZ 142 | MY5mtaNb+QCzi8/x5Pm/MMysoFiigt+FW0itvgcdM4kvlTWSQzCHdvPK3aXyieWGO/dZZgm8U1oQWSKH 143 | 3rSAHt0sNMZlrK+vY8byDFGlCgRktKO514hmhWH5y4AKd/KMvZY2MDr3OkGgwE8JTfglqxNnLv2O1Loh 144 | xFcNQdg9hZfWNTxe/hvJNQMIypMhp2EYynHLa69z4jQ6kiyt0BkXcTr/NnzOt+JEvgxR5b1IqlWi+vYk 145 | LE9eYPWlFZ1KMxJrhpi5AslV/Rh7uAIe05JvgqTE1n80Xw5eWhtOF8lxrnIAeTd0MM09hdVqxaBhCYU3 146 | x5EqVDHzPmSJlNCZluCXdKOEvg8TBslVM6v8XzXgpbcjlJUfXz2Ei02jUE4tQj/zFKK7ZhS1TCC9QYNo 147 | wT3Uywy4q/1r9WCEKIi2uGVvY++vHxh7jFMFMoQUyhFXOYhCZmCaXYF5/hnq5A9R0Py2gpTaYWiml3G5 148 | Sa138MjaRgDIO14S3qd7ZG3tf4AwVkFkWR9yrmswZV6E8dESytoNyGjU4gIzkGvnMDA2Z/VLkobbtPTF 149 | EQHZ7ct0jLjYWTM8bnnVo5tDTqMKSWxgWdfUyJVo2apFWet9DLFZqCYXXkUVddVu/CrTcbe/gGh/iIj2 150 | +BbSFm6kk3+CUCCWjf5j+23DhkX06C3oHZuHipU8yqYululf+MZcqbff/t2uN9lt2Hs0/+2GaAPR+047 151 | vg0PDIiraSyo75moaVUt2VhQr5jixVyWOrseCyXifMZiHTbZb2Xx/w87Rkf68OAucvZyIWdPLjnt/5yd 152 | fcC4+d39OxD9B81uQixYNjhgAAAAAElFTkSuQmCC 153 | 154 | 155 | 156 | 157 | iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 158 | YQUAAAAJcEhZcwAAEnEAABJxAfPceo4AAAK7SURBVDhPpZHdS5NxFMcfvOgm8NYL/wYvvBk6U3NOnXue 159 | Z+9zW9ssNS0MrDTSbhoZEUJFBIlUUmBXQaFQErVNp+mm2zP35rZn86UsRtbUmV0J8u1sLeq+A1/OuTif 160 | 3znn+2P+RMxoPLamtivTKvuoqLZOipxtKslZpuKkKGuejCnNoxGFRZnvKyK/I9RkO57W2EdE3p5LqW0Q 161 | VTYkeSvirAWrJAIRbTUjrDDlQs2mkXx/EWWYlMp6UeStR6kilCAgns/tvYhSHWlpy4NYoRyQG45Ilwrg 162 | Om8uS6ptwr/TxO7LEIeGsesPIjF4A7HOPgSbjRBIgSYDluQGwSvjy2iquZKA7QR3qrDi5q17OFjbwMb4 163 | c/xIb2Dt8UQhp4bvwC/XY7lRD1+DbnuhUV/JiKxFQjdlV+km8fwAfn7cwsbYU8T6ruFgcwvhC4NIPxwv 164 | 1CsdffCe1GChXptdlGkkTIzgaKspG2kx4vOTCewKYQR5G6I9A9hf30S4ux9L9HA2EML62DMs1KkwX6fK 165 | LtYW4TDBIbon8/I1vr51I0DGCNrTiAzdhF/dDq9Mh8y0E59eTGG+VoW5E3zWk4dXmg2SkMKUDcoNWH/w 166 | CLnVJATdGSw3GfPGwNughY822YslkLg7Ck8NB88JjmBWwoRbDRXBpraMQC4GLeewFxeRmZxGwNwDb4sJ 167 | y8az+PLqDXbo0Q/6DswS7JJymdmq1grGp7CWkoMuP01ZkmkR7L2K78Ew9tc2sUP375Pz34QQfD39mJGy 168 | cBPsrmFd0xJFaeGvfTKdhtbLUcZiPbnJWSFccSBy+z78/dcxS4a5iyBNzTmrWG0BzAccjhKvTG8jMDZX 169 | rzokNwu3zVQrC3JLObyXcofvqpQxp1RpczCOkiL6NxZlbPl8nZonuNNTy3d5avguN8lVzXY6azieJpYX 170 | W/83GOYXPPrP3Q6begUAAAAASUVORK5CYII= 171 | 172 | 173 | 174 | 188, 17 175 | 176 | 177 | 178 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 179 | YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAFzSURBVDhPjVO7TsNAEDTiJaAIfpAQiZKCmtdngBT+IIEO 180 | ko6ehB+ABgnoIyEqBEgoZ59oqMgPUCIhwGfgE8zOeR0ZYzsZ6STvemd27m7PGBnP4aTlBS1bqGvLDbq2 181 | qy5sqVb47xDIcILITdtT7crDe3n5/mWaRGoQ4YoCROQWk+c4a7BIl8McxGRXHSXJAJxgOxxmw5Rfu9S5 182 | s/T0OsMpDYghj21x6j+cR79KBWcl+TPveGqN7NaRZ3Kb4gM41MVpgExF22TxxBLBJm3h0hH+avXmbVaT 183 | 0fkqHOfyBEjRcf09dAbZ9II+fd9BBE5I6LiQTD9x2h2z910CidYtRCh3ClFajWzbidPWNqVah227pzbg 184 | hL63FuTnIlenEE1YMyaTvSnqeIg9wzY655MJunNySMJwDCLaSbTnhs7nAcOAoeBQY3DPRVcVA+OIseTw 185 | LznztFMgi+e0diBSFh8VTRbB/khkAE9Si+CJ4qninofZHsAwfgGsbv9AygaRwQAAAABJRU5ErkJggg== 186 | 187 | 188 | 189 | 190 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 191 | YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAFgSURBVDhPlZJPS8QwEMWrIuhNEES9KB5URARdL+LBg7tN 192 | uit42R6E1Zp0VQRBPPnnsh91QcQ2qeBHqHlhWrfasOwPApmXTpqZed4k5GE4Q9vJ+Lg8XdSCXWjJHrOY 193 | 3SWytUtH49E3bEVJ/pwK1kx6raUvwXdsHPM9+sRNJpurSvAXfc0OSLLofrBp9Pvc86ZI+k8+GEwrEVxp 194 | yfdJKvmOzhdU7D/kt41ZkqoMo5M5JJqn+iiB5JJUsiMlfEFhFRW1l7XgT+YCqWMeYp+KzgYdm7LYlorZ 195 | K8oj6RfbMFNzJoNDkrz3bnceC3skm0m8jV5YUiQXDfs78yzyt53JmDNGM9pt9CAVvJf1/YYW/hkur00G 196 | MAnmTKEFz1ZxcEwG6uAndFQFT4XDYBKSSpKIrWNR6Ab2hMMotBQN+5TtNZLcwNu2B8ZhMImdsxmVs+Y6 197 | 4G3YEw6DSWrnPA5422nPWjzvB9Bvql4AG7FQAAAAAElFTkSuQmCC 198 | 199 | 200 | 201 | 202 | iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 203 | YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAK+SURBVDhPpZHdS5NhGMZfPOgk8NQD/wYPPBlz05lz6rb3 204 | 3ffmtrZZaloYWGmknTQyIoSKCBKppMCOgkKhRGKbLnWbbu/cl/v+KIuRNXVmR4JcPe9a5HkXXNzPwf17 205 | 7ue+HuqvYgbDqazKJs8obVMplWUuxVjnk4x5Pk4cpU1zMblpKiI1y7m+KvJHoQ7r6YzaNhlnbOW0yoqU 206 | 0oqkwoI4bcYWMQERlZkQlhrLoU7jJNdfRSkqrbRcictNx+kqlCBAnKs9Q4iSc6SrmwOxSep6m+Y4INFf 207 | rYA5hakuqbKyJ6elBq4hNT6BPX8QibHbiPUNI9hpAEsc6NBjXaJnvWJFHZlqaozT3TsJ5mzliYW7D3GY 208 | zSM/8wo/M3lkn81WanriPvwSHTbadfC1anfW2nWNVIo288IyY2mL7JS6NIpfn7aRn36B2PBNHBa2Eb48 209 | hsyTmcp5s3cY3jNqfGzWlDxiNY+KEThE4EiXAV+ez2KPDSOosCI6OIqDXAHhgRGsk4tLgRBy0y+xJlIS 210 | mC55Wk7AIbJP8c07fFt0IUCCYTXnEBm/A7+qB16xFsUFBz6/nsdKCwfLS24O3uzU80JSYyko0SP3+CnK 211 | W0mw2vPY6DBwwcDbpoGPvGQ/lkDiwRTcQgbuZhmBaR4VlukbguLuIktSDJovYj+eQnFuAQHTILxdRmwY 212 | LuDr2/fYJZeu6nqxTGAHnyku82UNlE9qqSUJOv1kyrpYg+DQDfwIhnGQLWCX7H9Akv/OhuAbHMGSgIaL 213 | wC4h7VzgSWsrf+0Ta9WrImWZVHha1VhjLGCv2xG59wj+kVtYJoG5qqBTwJQdfFpTATnBbq/xinVWj0gd 214 | W2pljlZIotxuS03yil0CBosC5ugDXx5zCORWO2WvqaL/5BHT9SsilYLAfe4WRb9bqOh3ETub6D6HkFGQ 215 | ifXV1v8VRf0Gob3Pj+IcIf0AAAAASUVORK5CYII= 216 | 217 | 218 | 219 | True 220 | 221 | 222 | True 223 | 224 | 225 | True 226 | 227 | 228 | True 229 | 230 | 231 | True 232 | 233 | 234 | True 235 | 236 | 237 | True 238 | 239 | 240 | True 241 | 242 | 243 | 318, 17 244 | 245 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/Models/ListItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CodeAutogenerationTool.Models 8 | { 9 | class ListItem 10 | { 11 | public string Text { get; set; } 12 | 13 | public string Value { get; set; } 14 | 15 | /// 16 | /// 返回ListItem中的Text值 17 | /// 18 | /// 19 | public override string ToString() 20 | { 21 | return this.Text; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace CodeAutogenerationTool 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new MForm.MainForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("EasyFramework")] 9 | [assembly: AssemblyDescription("开源简易框架EasyFramework")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("哪来的公司")] 12 | [assembly: AssemblyProduct("EasyFramework")] 13 | [assembly: AssemblyCopyright("版权是啥")] 14 | [assembly: AssemblyTrademark("哪里来的商标")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("88491668-a04a-4073-91fd-29398ebe9b41")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 33 | // 方法是按如下所示使用“*”: : 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.42000 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CodeAutogenerationTool.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CodeAutogenerationTool.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 重写当前线程的 CurrentUICulture 属性 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 65 | /// 66 | internal static System.Drawing.Bitmap exit { 67 | get { 68 | object obj = ResourceManager.GetObject("exit", resourceCulture); 69 | return ((System.Drawing.Bitmap)(obj)); 70 | } 71 | } 72 | 73 | /// 74 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 75 | /// 76 | internal static System.Drawing.Bitmap help { 77 | get { 78 | object obj = ResourceManager.GetObject("help", resourceCulture); 79 | return ((System.Drawing.Bitmap)(obj)); 80 | } 81 | } 82 | 83 | /// 84 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 85 | /// 86 | internal static System.Drawing.Bitmap link { 87 | get { 88 | object obj = ResourceManager.GetObject("link", resourceCulture); 89 | return ((System.Drawing.Bitmap)(obj)); 90 | } 91 | } 92 | 93 | /// 94 | /// 查找 System.Drawing.Bitmap 类型的本地化资源。 95 | /// 96 | internal static System.Drawing.Bitmap unlink { 97 | get { 98 | object obj = ResourceManager.GetObject("unlink", resourceCulture); 99 | return ((System.Drawing.Bitmap)(obj)); 100 | } 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | ..\Images\exit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 123 | 124 | 125 | ..\Images\help.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 126 | 127 | 128 | ..\Images\link.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 129 | 130 | 131 | ..\Images\unlink.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a 132 | 133 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CodeAutogenerationTool.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CodeAutogenerationTool/UpgradeLog.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BruceLuo2/CodeAutogenerationTool/43fa4d4c89c81579cb0c9395521e619aa257ef8d/CodeAutogenerationTool/UpgradeLog.htm --------------------------------------------------------------------------------