├── MySql.Data.dll
├── EntityGenerator-Release
├── 使用前先读我.txt
├── MySql.Data.dll
└── EntityGenerator.exe
├── EntityGenerator
├── EntityGenerator
│ ├── DbStyle.cs
│ ├── Properties
│ │ ├── Settings.settings
│ │ ├── AssemblyInfo.cs
│ │ ├── Settings.Designer.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Program.cs
│ ├── CForm.cs
│ ├── EntityGenerator.csproj
│ ├── CForm.resx
│ ├── GForm.resx
│ ├── CForm.Designer.cs
│ ├── GForm.Designer.cs
│ └── GForm.cs
└── EntityGenerator.sln
├── README.md
├── LICENSE
└── .gitignore
/MySql.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crosg/Albianj2CodeGenerator/HEAD/MySql.Data.dll
--------------------------------------------------------------------------------
/EntityGenerator-Release/使用前先读我.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crosg/Albianj2CodeGenerator/HEAD/EntityGenerator-Release/使用前先读我.txt
--------------------------------------------------------------------------------
/EntityGenerator-Release/MySql.Data.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crosg/Albianj2CodeGenerator/HEAD/EntityGenerator-Release/MySql.Data.dll
--------------------------------------------------------------------------------
/EntityGenerator-Release/EntityGenerator.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/crosg/Albianj2CodeGenerator/HEAD/EntityGenerator-Release/EntityGenerator.exe
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/DbStyle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace EntityGenerator
6 | {
7 | public enum DbStyle
8 | {
9 | Mysql,
10 | SqlServer,
11 | Oracle
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Windows.Forms;
4 |
5 | namespace EntityGenerator
6 | {
7 | static class Program
8 | {
9 | ///
10 | /// 应用程序的主入口点。
11 | ///
12 | [STAThread]
13 | static void Main()
14 | {
15 | Application.EnableVisualStyles();
16 | Application.SetCompatibleTextRenderingDefault(false);
17 | Application.Run(new CForm());
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Albianj2CodeGenerator
2 | 这是一个为Albianj2开发的代码生成器。它主要被用来生成albianj2的实体类接口及其实
3 | 现、业务操作接口及其实现,还有使用albianj2进行编程的时候,可能会使用到的各种配
4 | 置文件。
5 |
6 | 目前该生成器只生成mysql数据库的表。原则上还会支持sqlserver和oracle。但是因为公司
7 | 内部的需求确实有限,所以目前暂时不支持。但是后期肯定会支持。
8 |
9 | 该生成器生成的源码和配置文件都是使用albianj中需要使用到的。该生成器的出现弱化了
10 | albianj的上手难度。可以让大家更容易、更快速的使用albianj。
11 |
12 | # 限制
13 | 1. 必须安装net framrwork2.0 以上的版本
14 |
15 | # 使用方法
16 | 1. 从EntityGenerator-Release中找到可执行文件
17 | 2. 双击打开,按照上面的项填入相应的数据库信息
18 | 3. 点击确定会打开连接服务器的数据库
19 | 4. 选择数据库,右边会列出表信息,可以编辑类这一栏
20 | 5. 填入各种pakeage的信息,选择生成路径
21 | 6. 点击生成,即可生成所有的java文件和配置信息(java文件包括:实体接口与实现、service接口与实现;
22 | 配置信息包括:实体的持久化配置、实体的数据路由配置、service的声明配置)
23 | 7. 将生成的源码cp到你的项目文件夹
24 | 8. 配置文件切勿直接cp到文件夹,而应该在已有的配置文件上增加,以免丢失你原来的配置
25 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityGenerator", "EntityGenerator\EntityGenerator.csproj", "{35AE7A4F-526F-43A3-8D59-0DC25E41F765}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {35AE7A4F-526F-43A3-8D59-0DC25E41F765}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {35AE7A4F-526F-43A3-8D59-0DC25E41F765}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {35AE7A4F-526F-43A3-8D59-0DC25E41F765}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {35AE7A4F-526F-43A3-8D59-0DC25E41F765}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的一般信息由以下
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("EntityGenerator")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Microsoft")]
12 | [assembly: AssemblyProduct("EntityGenerator")]
13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
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("35ae7a4f-526f-43a3-8d59-0dc25e41f765")]
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 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/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 EntityGenerator.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 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016, 阅文集团
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | * Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | * Neither the name of Albianj2CodeGenerator nor the names of its
15 | contributors may be used to endorse or promote products derived from
16 | this software without specific prior written permission.
17 |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // 此代码由工具生成。
4 | // 运行时版本: 4.0.30319.42000
5 | //
6 | // 对此文件的更改可能导致不正确的行为,如果
7 | // 重新生成代码,则所做更改将丢失。
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace EntityGenerator.Properties
12 | {
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", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// 返回此类使用的缓存 ResourceManager 实例。
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("EntityGenerator.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// 覆盖当前线程的 CurrentUICulture 属性
56 | /// 使用此强类型的资源类的资源查找。
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/CForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Text;
7 | using System.Windows.Forms;
8 |
9 | namespace EntityGenerator
10 | {
11 | public partial class CForm : Form
12 | {
13 | public CForm()
14 | {
15 | InitializeComponent();
16 | this.tbServer.Text = "127.0.0.1";
17 | }
18 |
19 | private void button1_Click(object sender, EventArgs e)
20 | {
21 | DbStyle style = DbStyle.Mysql;
22 | string sport = "0";
23 | string server = "127.0.0.1";
24 | string suser = "root";
25 | switch (cbDB.SelectedIndex)
26 | {
27 | case 0:
28 | {
29 | style = DbStyle.Mysql;
30 | if (string.IsNullOrEmpty(tbPort.Text))
31 | {
32 | sport = "3306";
33 | } else
34 | {
35 | sport = tbPort.Text.Trim();
36 | }
37 | if (!string.IsNullOrEmpty(tbServer.Text))
38 | {
39 | server = tbServer.Text.Trim();
40 | }
41 | break;
42 | }
43 | case 1:
44 | {
45 | style = DbStyle.SqlServer;
46 | break;
47 | }
48 | case 2:
49 | {
50 | style = DbStyle.Oracle;
51 | break;
52 | }
53 | default:
54 | {
55 | style = DbStyle.Mysql;
56 | break;
57 | }
58 | }
59 | string sconn = string.Format("Data Source = '{0}'; User Id = '{1}'; Password ='{2}' ; Port='{3}'; charset = 'utf8'; pooling = true",
60 | server, suser, tbPwd.Text,sport);
61 | GForm gf = new GForm(sconn,style);
62 | gf.Show();
63 | this.Hide();
64 | }
65 |
66 | private void cbDB_SelectedIndexChanged(object sender, EventArgs e)
67 | {
68 | int idx = cbDB.SelectedIndex;
69 | switch (idx)
70 | {
71 | case 0:
72 | {
73 | tbUserName.Text = "root";
74 | tbPort.Text = "3306";
75 | break;
76 | }
77 | case 1:
78 | {
79 | break;
80 | }
81 | case 2:
82 | {
83 | break;
84 | }
85 | default:
86 | {
87 | break;
88 | }
89 | }
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 |
24 | # Visual Studio 2015 cache/options directory
25 | .vs/
26 | # Uncomment if you have tasks that create the project's static files in wwwroot
27 | #wwwroot/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | # NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | # DNX
43 | project.lock.json
44 | artifacts/
45 |
46 | *_i.c
47 | *_p.c
48 | *_i.h
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.tmp_proj
63 | *.log
64 | *.vspscc
65 | *.vssscc
66 | .builds
67 | *.pidb
68 | *.svclog
69 | *.scc
70 |
71 | # Chutzpah Test files
72 | _Chutzpah*
73 |
74 | # Visual C++ cache files
75 | ipch/
76 | *.aps
77 | *.ncb
78 | *.opendb
79 | *.opensdf
80 | *.sdf
81 | *.cachefile
82 |
83 | # Visual Studio profiler
84 | *.psess
85 | *.vsp
86 | *.vspx
87 | *.sap
88 |
89 | # TFS 2012 Local Workspace
90 | $tf/
91 |
92 | # Guidance Automation Toolkit
93 | *.gpState
94 |
95 | # ReSharper is a .NET coding add-in
96 | _ReSharper*/
97 | *.[Rr]e[Ss]harper
98 | *.DotSettings.user
99 |
100 | # JustCode is a .NET coding add-in
101 | .JustCode
102 |
103 | # TeamCity is a build add-in
104 | _TeamCity*
105 |
106 | # DotCover is a Code Coverage Tool
107 | *.dotCover
108 |
109 | # NCrunch
110 | _NCrunch_*
111 | .*crunch*.local.xml
112 | nCrunchTemp_*
113 |
114 | # MightyMoose
115 | *.mm.*
116 | AutoTest.Net/
117 |
118 | # Web workbench (sass)
119 | .sass-cache/
120 |
121 | # Installshield output folder
122 | [Ee]xpress/
123 |
124 | # DocProject is a documentation generator add-in
125 | DocProject/buildhelp/
126 | DocProject/Help/*.HxT
127 | DocProject/Help/*.HxC
128 | DocProject/Help/*.hhc
129 | DocProject/Help/*.hhk
130 | DocProject/Help/*.hhp
131 | DocProject/Help/Html2
132 | DocProject/Help/html
133 |
134 | # Click-Once directory
135 | publish/
136 |
137 | # Publish Web Output
138 | *.[Pp]ublish.xml
139 | *.azurePubxml
140 | # TODO: Comment the next line if you want to checkin your web deploy settings
141 | # but database connection strings (with potential passwords) will be unencrypted
142 | *.pubxml
143 | *.publishproj
144 |
145 | # NuGet Packages
146 | *.nupkg
147 | # The packages folder can be ignored because of Package Restore
148 | **/packages/*
149 | # except build/, which is used as an MSBuild target.
150 | !**/packages/build/
151 | # Uncomment if necessary however generally it will be regenerated when needed
152 | #!**/packages/repositories.config
153 | # NuGet v3's project.json files produces more ignoreable files
154 | *.nuget.props
155 | *.nuget.targets
156 |
157 | # Microsoft Azure Build Output
158 | csx/
159 | *.build.csdef
160 |
161 | # Microsoft Azure Emulator
162 | ecf/
163 | rcf/
164 |
165 | # Microsoft Azure ApplicationInsights config file
166 | ApplicationInsights.config
167 |
168 | # Windows Store app package directory
169 | AppPackages/
170 | BundleArtifacts/
171 |
172 | # Visual Studio cache files
173 | # files ending in .cache can be ignored
174 | *.[Cc]ache
175 | # but keep track of directories ending in .cache
176 | !*.[Cc]ache/
177 |
178 | # Others
179 | ClientBin/
180 | ~$*
181 | *~
182 | *.dbmdl
183 | *.dbproj.schemaview
184 | *.pfx
185 | *.publishsettings
186 | node_modules/
187 | orleans.codegen.cs
188 |
189 | # RIA/Silverlight projects
190 | Generated_Code/
191 |
192 | # Backup & report files from converting an old project file
193 | # to a newer Visual Studio version. Backup files are not needed,
194 | # because we have git ;-)
195 | _UpgradeReport_Files/
196 | Backup*/
197 | UpgradeLog*.XML
198 | UpgradeLog*.htm
199 |
200 | # SQL Server files
201 | *.mdf
202 | *.ldf
203 |
204 | # Business Intelligence projects
205 | *.rdl.data
206 | *.bim.layout
207 | *.bim_*.settings
208 |
209 | # Microsoft Fakes
210 | FakesAssemblies/
211 |
212 | # GhostDoc plugin setting file
213 | *.GhostDoc.xml
214 |
215 | # Node.js Tools for Visual Studio
216 | .ntvs_analysis.dat
217 |
218 | # Visual Studio 6 build log
219 | *.plg
220 |
221 | # Visual Studio 6 workspace options file
222 | *.opt
223 |
224 | # Visual Studio LightSwitch build output
225 | **/*.HTMLClient/GeneratedArtifacts
226 | **/*.DesktopClient/GeneratedArtifacts
227 | **/*.DesktopClient/ModelManifest.xml
228 | **/*.Server/GeneratedArtifacts
229 | **/*.Server/ModelManifest.xml
230 | _Pvt_Extensions
231 |
232 | # Paket dependency manager
233 | .paket/paket.exe
234 |
235 | # FAKE - F# Make
236 | .fake/
237 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/EntityGenerator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {35AE7A4F-526F-43A3-8D59-0DC25E41F765}
8 | WinExe
9 | Properties
10 | EntityGenerator
11 | EntityGenerator
12 | v2.0
13 | 512
14 | false
15 | E:\sync\tencent\common\dev\EntityGenerator\product\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | true
29 | true
30 |
31 |
32 | AnyCPU
33 | true
34 | full
35 | false
36 | bin\Debug\
37 | DEBUG;TRACE
38 | prompt
39 | 4
40 |
41 |
42 | AnyCPU
43 | pdbonly
44 | true
45 | bin\Release\
46 | TRACE
47 | prompt
48 | 4
49 |
50 |
51 | B0DF15CD6B63561715468DA06635BA0A0EF93903
52 |
53 |
54 | EntityGenerator_TemporaryKey.pfx
55 |
56 |
57 | true
58 |
59 |
60 | false
61 |
62 |
63 |
64 | ..\..\MySql.Data.dll
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | Form
77 |
78 |
79 | CForm.cs
80 |
81 |
82 |
83 | Form
84 |
85 |
86 | GForm.cs
87 |
88 |
89 |
90 |
91 | CForm.cs
92 |
93 |
94 | GForm.cs
95 |
96 |
97 | ResXFileCodeGenerator
98 | Resources.Designer.cs
99 | Designer
100 |
101 |
102 | True
103 | Resources.resx
104 |
105 |
106 | SettingsSingleFileGenerator
107 | Settings.Designer.cs
108 |
109 |
110 | True
111 | Settings.settings
112 | True
113 |
114 |
115 |
116 |
117 | False
118 | .NET Framework 3.5 SP1
119 | true
120 |
121 |
122 |
123 |
130 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/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 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/CForm.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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | True
122 |
123 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/GForm.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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 17
122 |
123 |
124 | True
125 |
126 |
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/CForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace EntityGenerator
2 | {
3 | partial class CForm
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.button1 = new System.Windows.Forms.Button();
32 | this.cbDB = new System.Windows.Forms.ComboBox();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | this.label3 = new System.Windows.Forms.Label();
36 | this.label4 = new System.Windows.Forms.Label();
37 | this.label5 = new System.Windows.Forms.Label();
38 | this.tbServer = new System.Windows.Forms.TextBox();
39 | this.tbPort = new System.Windows.Forms.TextBox();
40 | this.tbUserName = new System.Windows.Forms.TextBox();
41 | this.tbPwd = new System.Windows.Forms.TextBox();
42 | this.label6 = new System.Windows.Forms.Label();
43 | this.SuspendLayout();
44 | //
45 | // button1
46 | //
47 | this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
48 | | System.Windows.Forms.AnchorStyles.Left)
49 | | System.Windows.Forms.AnchorStyles.Right)));
50 | this.button1.Location = new System.Drawing.Point(299, 352);
51 | this.button1.Name = "button1";
52 | this.button1.Size = new System.Drawing.Size(75, 23);
53 | this.button1.TabIndex = 6;
54 | this.button1.Text = "连接服务器";
55 | this.button1.UseVisualStyleBackColor = true;
56 | this.button1.Click += new System.EventHandler(this.button1_Click);
57 | //
58 | // cbDB
59 | //
60 | this.cbDB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
61 | | System.Windows.Forms.AnchorStyles.Left)
62 | | System.Windows.Forms.AnchorStyles.Right)));
63 | this.cbDB.FormattingEnabled = true;
64 | this.cbDB.Items.AddRange(new object[] {
65 | "Mysql",
66 | "SqlServer",
67 | "Oracle"});
68 | this.cbDB.Location = new System.Drawing.Point(328, 113);
69 | this.cbDB.Name = "cbDB";
70 | this.cbDB.Size = new System.Drawing.Size(171, 20);
71 | this.cbDB.TabIndex = 1;
72 | this.cbDB.Text = "选择数据库类型";
73 | this.cbDB.SelectedIndexChanged += new System.EventHandler(this.cbDB_SelectedIndexChanged);
74 | //
75 | // label1
76 | //
77 | this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
78 | | System.Windows.Forms.AnchorStyles.Left)
79 | | System.Windows.Forms.AnchorStyles.Right)));
80 | this.label1.AutoSize = true;
81 | this.label1.Location = new System.Drawing.Point(196, 116);
82 | this.label1.Name = "label1";
83 | this.label1.Size = new System.Drawing.Size(77, 12);
84 | this.label1.TabIndex = 2;
85 | this.label1.Text = "数据库类型:";
86 | //
87 | // label2
88 | //
89 | this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
90 | | System.Windows.Forms.AnchorStyles.Left)
91 | | System.Windows.Forms.AnchorStyles.Right)));
92 | this.label2.AutoSize = true;
93 | this.label2.Location = new System.Drawing.Point(196, 155);
94 | this.label2.Name = "label2";
95 | this.label2.Size = new System.Drawing.Size(77, 12);
96 | this.label2.TabIndex = 3;
97 | this.label2.Text = "服务器地址:";
98 | //
99 | // label3
100 | //
101 | this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
102 | | System.Windows.Forms.AnchorStyles.Left)
103 | | System.Windows.Forms.AnchorStyles.Right)));
104 | this.label3.AutoSize = true;
105 | this.label3.Location = new System.Drawing.Point(196, 199);
106 | this.label3.Name = "label3";
107 | this.label3.Size = new System.Drawing.Size(41, 12);
108 | this.label3.TabIndex = 4;
109 | this.label3.Text = "端口:";
110 | //
111 | // label4
112 | //
113 | this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
114 | | System.Windows.Forms.AnchorStyles.Left)
115 | | System.Windows.Forms.AnchorStyles.Right)));
116 | this.label4.AutoSize = true;
117 | this.label4.Location = new System.Drawing.Point(196, 245);
118 | this.label4.Name = "label4";
119 | this.label4.Size = new System.Drawing.Size(53, 12);
120 | this.label4.TabIndex = 5;
121 | this.label4.Text = "用户名:";
122 | //
123 | // label5
124 | //
125 | this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
126 | | System.Windows.Forms.AnchorStyles.Left)
127 | | System.Windows.Forms.AnchorStyles.Right)));
128 | this.label5.AutoSize = true;
129 | this.label5.Location = new System.Drawing.Point(196, 285);
130 | this.label5.Name = "label5";
131 | this.label5.Size = new System.Drawing.Size(41, 12);
132 | this.label5.TabIndex = 6;
133 | this.label5.Text = "密码:";
134 | //
135 | // tbServer
136 | //
137 | this.tbServer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
138 | | System.Windows.Forms.AnchorStyles.Left)
139 | | System.Windows.Forms.AnchorStyles.Right)));
140 | this.tbServer.Location = new System.Drawing.Point(328, 155);
141 | this.tbServer.Name = "tbServer";
142 | this.tbServer.Size = new System.Drawing.Size(171, 21);
143 | this.tbServer.TabIndex = 2;
144 | //
145 | // tbPort
146 | //
147 | this.tbPort.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
148 | | System.Windows.Forms.AnchorStyles.Left)
149 | | System.Windows.Forms.AnchorStyles.Right)));
150 | this.tbPort.Location = new System.Drawing.Point(328, 199);
151 | this.tbPort.Name = "tbPort";
152 | this.tbPort.Size = new System.Drawing.Size(171, 21);
153 | this.tbPort.TabIndex = 3;
154 | //
155 | // tbUserName
156 | //
157 | this.tbUserName.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
158 | | System.Windows.Forms.AnchorStyles.Left)
159 | | System.Windows.Forms.AnchorStyles.Right)));
160 | this.tbUserName.Location = new System.Drawing.Point(328, 242);
161 | this.tbUserName.Name = "tbUserName";
162 | this.tbUserName.Size = new System.Drawing.Size(171, 21);
163 | this.tbUserName.TabIndex = 4;
164 | //
165 | // tbPwd
166 | //
167 | this.tbPwd.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
168 | | System.Windows.Forms.AnchorStyles.Left)
169 | | System.Windows.Forms.AnchorStyles.Right)));
170 | this.tbPwd.Location = new System.Drawing.Point(328, 285);
171 | this.tbPwd.Name = "tbPwd";
172 | this.tbPwd.Size = new System.Drawing.Size(171, 21);
173 | this.tbPwd.TabIndex = 5;
174 | //
175 | // label6
176 | //
177 | this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
178 | | System.Windows.Forms.AnchorStyles.Left)
179 | | System.Windows.Forms.AnchorStyles.Right)));
180 | this.label6.AutoSize = true;
181 | this.label6.Location = new System.Drawing.Point(196, 53);
182 | this.label6.Name = "label6";
183 | this.label6.Size = new System.Drawing.Size(317, 12);
184 | this.label6.TabIndex = 11;
185 | this.label6.Text = "警告:用于生成代码的用户必须拥有系统信息表可读权限!";
186 | //
187 | // CForm
188 | //
189 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
190 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
191 | this.ClientSize = new System.Drawing.Size(719, 478);
192 | this.Controls.Add(this.label6);
193 | this.Controls.Add(this.tbPwd);
194 | this.Controls.Add(this.tbUserName);
195 | this.Controls.Add(this.tbPort);
196 | this.Controls.Add(this.tbServer);
197 | this.Controls.Add(this.label5);
198 | this.Controls.Add(this.label4);
199 | this.Controls.Add(this.label3);
200 | this.Controls.Add(this.label2);
201 | this.Controls.Add(this.label1);
202 | this.Controls.Add(this.cbDB);
203 | this.Controls.Add(this.button1);
204 | this.MaximizeBox = false;
205 | this.MaximumSize = new System.Drawing.Size(735, 516);
206 | this.MinimumSize = new System.Drawing.Size(735, 516);
207 | this.Name = "CForm";
208 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
209 | this.Text = "CForm";
210 | this.ResumeLayout(false);
211 | this.PerformLayout();
212 |
213 | }
214 |
215 | #endregion
216 |
217 | private System.Windows.Forms.Button button1;
218 | private System.Windows.Forms.ComboBox cbDB;
219 | private System.Windows.Forms.Label label1;
220 | private System.Windows.Forms.Label label2;
221 | private System.Windows.Forms.Label label3;
222 | private System.Windows.Forms.Label label4;
223 | private System.Windows.Forms.Label label5;
224 | private System.Windows.Forms.TextBox tbServer;
225 | private System.Windows.Forms.TextBox tbPort;
226 | private System.Windows.Forms.TextBox tbUserName;
227 | private System.Windows.Forms.TextBox tbPwd;
228 | private System.Windows.Forms.Label label6;
229 | }
230 | }
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/GForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace EntityGenerator
2 | {
3 | partial class GForm
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.tv = new System.Windows.Forms.TreeView();
32 | this.label1 = new System.Windows.Forms.Label();
33 | this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
34 | this.button1 = new System.Windows.Forms.Button();
35 | this.label2 = new System.Windows.Forms.Label();
36 | this.tbPath = new System.Windows.Forms.TextBox();
37 | this.dgv = new System.Windows.Forms.DataGridView();
38 | this.label3 = new System.Windows.Forms.Label();
39 | this.tbinterface = new System.Windows.Forms.TextBox();
40 | this.label5 = new System.Windows.Forms.Label();
41 | this.tbclass = new System.Windows.Forms.TextBox();
42 | this.label4 = new System.Windows.Forms.Label();
43 | this.label6 = new System.Windows.Forms.Label();
44 | this.tbSpe = new System.Windows.Forms.TextBox();
45 | this.label7 = new System.Windows.Forms.Label();
46 | this.tbdrouter = new System.Windows.Forms.TextBox();
47 | this.tbsif = new System.Windows.Forms.TextBox();
48 | this.label9 = new System.Windows.Forms.Label();
49 | this.tbscl = new System.Windows.Forms.TextBox();
50 | this.label8 = new System.Windows.Forms.Label();
51 | ((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
52 | this.SuspendLayout();
53 | //
54 | // tv
55 | //
56 | this.tv.Location = new System.Drawing.Point(30, 64);
57 | this.tv.Name = "tv";
58 | this.tv.Size = new System.Drawing.Size(180, 452);
59 | this.tv.TabIndex = 0;
60 | this.tv.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.tv_NodeMouseClick);
61 | //
62 | // label1
63 | //
64 | this.label1.AutoSize = true;
65 | this.label1.Location = new System.Drawing.Point(28, 34);
66 | this.label1.Name = "label1";
67 | this.label1.Size = new System.Drawing.Size(53, 12);
68 | this.label1.TabIndex = 1;
69 | this.label1.Text = "数据库:";
70 | //
71 | // button1
72 | //
73 | this.button1.Location = new System.Drawing.Point(854, 597);
74 | this.button1.Name = "button1";
75 | this.button1.Size = new System.Drawing.Size(75, 23);
76 | this.button1.TabIndex = 2;
77 | this.button1.Text = "生成代码";
78 | this.button1.UseVisualStyleBackColor = true;
79 | this.button1.Click += new System.EventHandler(this.button1_Click);
80 | //
81 | // label2
82 | //
83 | this.label2.AutoSize = true;
84 | this.label2.Location = new System.Drawing.Point(92, 645);
85 | this.label2.Name = "label2";
86 | this.label2.Size = new System.Drawing.Size(89, 12);
87 | this.label2.TabIndex = 3;
88 | this.label2.Text = "代码生成路径:";
89 | //
90 | // tbPath
91 | //
92 | this.tbPath.Location = new System.Drawing.Point(225, 642);
93 | this.tbPath.Name = "tbPath";
94 | this.tbPath.Size = new System.Drawing.Size(587, 21);
95 | this.tbPath.TabIndex = 4;
96 | this.tbPath.MouseClick += new System.Windows.Forms.MouseEventHandler(this.textBox1_MouseClick);
97 | //
98 | // dgv
99 | //
100 | this.dgv.AllowUserToAddRows = false;
101 | this.dgv.AllowUserToDeleteRows = false;
102 | this.dgv.AllowUserToOrderColumns = true;
103 | this.dgv.AllowUserToResizeColumns = false;
104 | this.dgv.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
105 | | System.Windows.Forms.AnchorStyles.Left)
106 | | System.Windows.Forms.AnchorStyles.Right)));
107 | this.dgv.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
108 | this.dgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
109 | this.dgv.Location = new System.Drawing.Point(225, 64);
110 | this.dgv.Name = "dgv";
111 | this.dgv.RowTemplate.Height = 23;
112 | this.dgv.Size = new System.Drawing.Size(735, 452);
113 | this.dgv.TabIndex = 5;
114 | //
115 | // label3
116 | //
117 | this.label3.AutoSize = true;
118 | this.label3.Location = new System.Drawing.Point(223, 34);
119 | this.label3.Name = "label3";
120 | this.label3.Size = new System.Drawing.Size(53, 12);
121 | this.label3.TabIndex = 6;
122 | this.label3.Text = "表列表:";
123 | //
124 | // tbinterface
125 | //
126 | this.tbinterface.Location = new System.Drawing.Point(225, 558);
127 | this.tbinterface.Name = "tbinterface";
128 | this.tbinterface.Size = new System.Drawing.Size(235, 21);
129 | this.tbinterface.TabIndex = 10;
130 | //
131 | // label5
132 | //
133 | this.label5.AutoSize = true;
134 | this.label5.Location = new System.Drawing.Point(476, 561);
135 | this.label5.Name = "label5";
136 | this.label5.Size = new System.Drawing.Size(77, 12);
137 | this.label5.TabIndex = 11;
138 | this.label5.Text = "实体类包名:";
139 | //
140 | // tbclass
141 | //
142 | this.tbclass.Location = new System.Drawing.Point(577, 558);
143 | this.tbclass.Name = "tbclass";
144 | this.tbclass.Size = new System.Drawing.Size(235, 21);
145 | this.tbclass.TabIndex = 12;
146 | //
147 | // label4
148 | //
149 | this.label4.AutoSize = true;
150 | this.label4.Location = new System.Drawing.Point(92, 561);
151 | this.label4.Name = "label4";
152 | this.label4.Size = new System.Drawing.Size(89, 12);
153 | this.label4.TabIndex = 13;
154 | this.label4.Text = "实体接口包名:";
155 | //
156 | // label6
157 | //
158 | this.label6.AutoSize = true;
159 | this.label6.Location = new System.Drawing.Point(92, 532);
160 | this.label6.Name = "label6";
161 | this.label6.Size = new System.Drawing.Size(113, 12);
162 | this.label6.TabIndex = 14;
163 | this.label6.Text = "数据库表名分隔符:";
164 | //
165 | // tbSpe
166 | //
167 | this.tbSpe.Location = new System.Drawing.Point(225, 529);
168 | this.tbSpe.Name = "tbSpe";
169 | this.tbSpe.Size = new System.Drawing.Size(94, 21);
170 | this.tbSpe.TabIndex = 15;
171 | //
172 | // label7
173 | //
174 | this.label7.AutoSize = true;
175 | this.label7.Location = new System.Drawing.Point(92, 618);
176 | this.label7.Name = "label7";
177 | this.label7.Size = new System.Drawing.Size(89, 12);
178 | this.label7.TabIndex = 16;
179 | this.label7.Text = "数据路由包名:";
180 | //
181 | // tbdrouter
182 | //
183 | this.tbdrouter.Location = new System.Drawing.Point(225, 615);
184 | this.tbdrouter.Name = "tbdrouter";
185 | this.tbdrouter.Size = new System.Drawing.Size(587, 21);
186 | this.tbdrouter.TabIndex = 17;
187 | //
188 | // tbsif
189 | //
190 | this.tbsif.Location = new System.Drawing.Point(225, 585);
191 | this.tbsif.Name = "tbsif";
192 | this.tbsif.Size = new System.Drawing.Size(235, 21);
193 | this.tbsif.TabIndex = 18;
194 | //
195 | // label9
196 | //
197 | this.label9.AutoSize = true;
198 | this.label9.Location = new System.Drawing.Point(476, 588);
199 | this.label9.Name = "label9";
200 | this.label9.Size = new System.Drawing.Size(95, 12);
201 | this.label9.TabIndex = 19;
202 | this.label9.Text = "service类包名:";
203 | //
204 | // tbscl
205 | //
206 | this.tbscl.Location = new System.Drawing.Point(577, 585);
207 | this.tbscl.Name = "tbscl";
208 | this.tbscl.Size = new System.Drawing.Size(235, 21);
209 | this.tbscl.TabIndex = 20;
210 | //
211 | // label8
212 | //
213 | this.label8.AutoSize = true;
214 | this.label8.Location = new System.Drawing.Point(92, 588);
215 | this.label8.Name = "label8";
216 | this.label8.Size = new System.Drawing.Size(107, 12);
217 | this.label8.TabIndex = 21;
218 | this.label8.Text = "service接口包名:";
219 | //
220 | // GForm
221 | //
222 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
223 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
224 | this.ClientSize = new System.Drawing.Size(1001, 679);
225 | this.Controls.Add(this.label8);
226 | this.Controls.Add(this.tbscl);
227 | this.Controls.Add(this.label9);
228 | this.Controls.Add(this.tbsif);
229 | this.Controls.Add(this.tbdrouter);
230 | this.Controls.Add(this.label7);
231 | this.Controls.Add(this.tbSpe);
232 | this.Controls.Add(this.label6);
233 | this.Controls.Add(this.label4);
234 | this.Controls.Add(this.tbclass);
235 | this.Controls.Add(this.label5);
236 | this.Controls.Add(this.tbinterface);
237 | this.Controls.Add(this.label3);
238 | this.Controls.Add(this.dgv);
239 | this.Controls.Add(this.tbPath);
240 | this.Controls.Add(this.label2);
241 | this.Controls.Add(this.button1);
242 | this.Controls.Add(this.label1);
243 | this.Controls.Add(this.tv);
244 | this.MaximizeBox = false;
245 | this.MaximumSize = new System.Drawing.Size(1017, 717);
246 | this.MinimumSize = new System.Drawing.Size(1017, 717);
247 | this.Name = "GForm";
248 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
249 | this.Text = "GForm";
250 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.GForm_FormClosed);
251 | ((System.ComponentModel.ISupportInitialize)(this.dgv)).EndInit();
252 | this.ResumeLayout(false);
253 | this.PerformLayout();
254 |
255 | }
256 |
257 | #endregion
258 |
259 | private System.Windows.Forms.TreeView tv;
260 | private System.Windows.Forms.Label label1;
261 | private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
262 | private System.Windows.Forms.Button button1;
263 | private System.Windows.Forms.Label label2;
264 | private System.Windows.Forms.TextBox tbPath;
265 | private System.Windows.Forms.DataGridView dgv;
266 | private System.Windows.Forms.Label label3;
267 | private System.Windows.Forms.TextBox tbinterface;
268 | private System.Windows.Forms.Label label5;
269 | private System.Windows.Forms.TextBox tbclass;
270 | private System.Windows.Forms.Label label4;
271 | private System.Windows.Forms.Label label6;
272 | private System.Windows.Forms.TextBox tbSpe;
273 | private System.Windows.Forms.Label label7;
274 | private System.Windows.Forms.TextBox tbdrouter;
275 | private System.Windows.Forms.TextBox tbsif;
276 | private System.Windows.Forms.Label label9;
277 | private System.Windows.Forms.TextBox tbscl;
278 | private System.Windows.Forms.Label label8;
279 | }
280 | }
--------------------------------------------------------------------------------
/EntityGenerator/EntityGenerator/GForm.cs:
--------------------------------------------------------------------------------
1 | using MySql.Data.MySqlClient;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Data;
6 | using System.Drawing;
7 | using System.IO;
8 | using System.Text;
9 | using System.Threading;
10 | using System.Windows.Forms;
11 |
12 | namespace EntityGenerator
13 | {
14 | public partial class GForm : Form
15 | {
16 | private string _strConn = null;
17 | private DbStyle _style = DbStyle.Mysql;
18 |
19 | public GForm(string strConn, DbStyle style)
20 | {
21 | this._strConn = strConn;
22 | this._style = style;
23 | InitializeComponent();
24 | startup();
25 | }
26 |
27 | private void GForm_FormClosed(object sender, FormClosedEventArgs e)
28 | {
29 | Application.Exit();
30 | }
31 |
32 | private void textBox1_MouseClick(object sender, MouseEventArgs e)
33 | {
34 | this.folderBrowserDialog1.ShowDialog();
35 | this.tbPath.Text = this.folderBrowserDialog1.SelectedPath;
36 | }
37 |
38 | private void button1_Click(object sender, EventArgs e)
39 | {
40 | string path = this.tbPath.Text;
41 | string ifpkg = this.tbinterface.Text;
42 | string clpkg = this.tbclass.Text;
43 | string dbname = this.tv.SelectedNode.Text;
44 | string drpkg = this.tbdrouter.Text;
45 | string sifpkg = tbsif.Text;
46 | string sclpkg = tbscl.Text;
47 |
48 |
49 | if (Directory.Exists(path + "\\service\\"))
50 | Directory.Delete(path + "\\service\\",true);
51 | if (Directory.Exists(path + "\\data\\"))
52 | Directory.Delete(path + "\\data\\",true);
53 | if (Directory.Exists(path + "\\drouter\\"))
54 | Directory.Delete(path + "\\drouter\\",true);
55 | Directory.CreateDirectory(path + "\\service\\");
56 | Directory.CreateDirectory(path + "\\data\\");
57 | Directory.CreateDirectory(path + "\\drouter\\");
58 |
59 | DataGridViewRowCollection rc = dgv.Rows;
60 | StringBuilder sbPersistence = new StringBuilder();
61 | sbPersistence.AppendLine("")
62 | .AppendLine("");
63 |
64 | StringBuilder sbRouter = new StringBuilder();
65 | sbRouter.AppendLine("")
66 | .AppendLine("");
67 |
68 | StringBuilder sbService = new StringBuilder();
69 | sbService.AppendLine("")
70 | .AppendLine(" ");
71 |
72 | foreach (DataGridViewRow r in rc)
73 | {
74 | DataGridViewCheckBoxCell c = (DataGridViewCheckBoxCell) r.Cells[0];
75 | string _selectValue = c.EditedFormattedValue.ToString();
76 | if (_selectValue == "True")
77 | {
78 | DataGridViewTextBoxCell tc = (DataGridViewTextBoxCell)r.Cells[1];
79 | DataGridViewTextBoxCell tc2 = (DataGridViewTextBoxCell)r.Cells[2];
80 |
81 | string tname = tc.EditedFormattedValue.ToString();
82 | string defclassname = tc2.EditedFormattedValue.ToString();
83 | string serviceId = "Yw" + defclassname + "Service";
84 | string sclassname = defclassname + "Service";
85 | string sifname = "I" + defclassname + "Service";
86 |
87 | makeFile(path, ifpkg, clpkg, dbname, tname, defclassname, sbPersistence);
88 |
89 | sbService.Append(" ");
92 |
93 |
94 | string dr = defclassname + "DataRouter";
95 | string ifname = "I" + defclassname;
96 | sbRouter.AppendFormat(" ")
100 | .AppendLine(" ")
101 | .AppendFormat(" ", tc.EditedFormattedValue.ToString()).AppendLine()
103 | .AppendLine(" ")
104 | .AppendLine(" ")
105 | .AppendFormat(" ", tc.EditedFormattedValue.ToString()).AppendLine()
107 | .AppendLine(" ")
108 | .AppendLine(" ");
109 |
110 | StringBuilder sbRouterCode = new StringBuilder();
111 | sbRouterCode.Append("package ").Append(drpkg).AppendLine(";")
112 | .AppendLine()
113 | .AppendLine("import java.util.LinkedList;")
114 | .AppendLine("import java.util.List;")
115 | .AppendLine("import java.util.Map;")
116 | .AppendLine()
117 | .AppendLine("import org.albianj.persistence.object.FreeAlbianObjectDataRouter;")
118 | .AppendLine("import org.albianj.persistence.object.IAlbianObject;")
119 | .AppendLine("import org.albianj.persistence.object.IDataRouterAttribute;")
120 | .AppendLine("import org.albianj.persistence.object.IFilterCondition;")
121 | .AppendLine("import org.albianj.persistence.object.IOrderByCondition;")
122 | .AppendLine("import org.albianj.persistence.object.IStorageAttribute;")
123 | .Append("import ").Append(ifpkg).Append(".").Append(ifname).AppendLine(";")
124 | .AppendLine()
125 | .Append("public class ").Append(dr).AppendLine(" extends FreeAlbianObjectDataRouter { ")
126 | .AppendLine("//如果需要数据路由算法,请执行override对应的方法")
127 | .AppendLine("}");
128 |
129 | StringBuilder sbServiceIf = new StringBuilder();
130 | sbServiceIf.Append("package ").Append(sifpkg).AppendLine(";").AppendLine()
131 | .AppendLine("import org.albianj.persistence.object.IAlbianObject;")
132 | .AppendLine("import org.albianj.service.IAlbianService;")
133 | .AppendLine()
134 | .Append("public interface ").Append(sifname).Append(" extends IAlbianService {").AppendLine()
135 | .AppendLine()
136 | .Append("//请根据自己的需求,声明接口方法").AppendLine()
137 | .Append("//不要修改自动生成的name,,如果需要修改,请同时修改service中的serviceid").AppendLine()
138 | .Append(" final static String Name = \"").Append(serviceId).AppendLine("\";").AppendLine()
139 | .AppendLine("}");
140 |
141 | StringBuilder sbServiceClass = new StringBuilder();
142 | sbServiceClass.Append("package ").Append(sclpkg).AppendLine(";").AppendLine()
143 | .AppendLine("import org.albianj.service.FreeAlbianService;")
144 | .AppendLine("import ").Append(sifpkg).Append(".").Append(sifname).AppendLine(";").AppendLine()
145 | .Append("public class ").Append(sclassname).Append(" extends FreeAlbianService implements ").Append(sifname).AppendLine("{")
146 | .AppendLine("//请自行实现业务接口中的方法")
147 | .AppendLine("}");
148 |
149 | string drpath = tbPath.Text + "\\drouter\\" + dr + ".java";
150 | File.WriteAllText(drpath,sbRouterCode.ToString());
151 | string sifpath = tbPath.Text + "\\service\\" + sifname + ".java";
152 | string sclpath = tbPath.Text + "\\service\\" + sclassname + ".java";
153 | File.WriteAllText(sifpath,sbServiceIf.ToString());
154 | File.WriteAllText(sclpath, sbServiceClass.ToString());
155 |
156 | }
157 |
158 | }
159 |
160 | sbPersistence.AppendLine("");
161 | sbRouter.AppendLine("");
162 | sbService.AppendLine("");
163 | string xmlpath = tbPath.Text + "\\" + "persisten.xml";
164 | File.WriteAllText(xmlpath, sbPersistence.ToString());
165 | File.WriteAllText(tbPath.Text + "\\drouter.xml", sbRouter.ToString());
166 | File.WriteAllText(tbPath.Text + "\\service.xml", sbService.ToString());
167 |
168 | MessageBox.Show("生成成功!");
169 | }
170 |
171 | private void startup()
172 | {
173 |
174 | switch (_style)
175 | {
176 | case DbStyle.Mysql:
177 | string sSysDatabase = "information_schema";
178 | string sconn = makeConnectString(sSysDatabase);
179 | IDbConnection conn = null;
180 | try
181 | {
182 | conn = new MySqlConnection(sconn);
183 | conn.Open();
184 | IDbCommand cmd = null;
185 | try
186 | {
187 | cmd = new MySqlCommand(@"select * from schemata",(MySqlConnection) conn);
188 | cmd.CommandType = CommandType.Text;
189 | MySqlDataReader dr = null;
190 | try
191 | {
192 | dr = ((MySqlCommand) cmd).ExecuteReader();
193 | if(null != dr)
194 | {
195 | while (dr.Read())
196 | {
197 | String schema = dr.GetString("schema_name");
198 | tv.Nodes.Add(schema);
199 | }
200 | }
201 |
202 | }
203 | catch(Exception e2)
204 | {
205 |
206 | }
207 | finally
208 | {
209 | if(null != dr)
210 | {
211 | dr.Close();
212 | }
213 | }
214 | }catch(Exception e1)
215 | {
216 |
217 | }
218 | finally
219 | {
220 | if (null != cmd)
221 | cmd.Dispose();
222 | }
223 |
224 | }catch(Exception e)
225 | {
226 |
227 | }
228 | finally
229 | {
230 | if(null != conn)
231 | {
232 | conn.Close();
233 | }
234 | }
235 |
236 |
237 |
238 | break;
239 | case DbStyle.SqlServer:
240 | break;
241 | case DbStyle.Oracle:
242 | break;
243 | default:
244 | break;
245 | }
246 | }
247 |
248 | private string makeConnectString(string dbName)
249 | {
250 | String sconn = this._strConn + ";Database=" + dbName;
251 | return sconn;
252 | // Database = '数据库名'; Data Source = '数据库服务器地址'; User Id = '数据库用户名'; Password = '密码'; charset = 'utf8'; pooling = true "information_schema"
253 | }
254 |
255 | private void tv_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
256 | {
257 | switch (_style)
258 | {
259 | case DbStyle.Mysql:
260 | string sSysDatabase = "information_schema";
261 | string sconn = makeConnectString(sSysDatabase);
262 | IDbConnection conn = null;
263 | try
264 | {
265 | conn = new MySqlConnection(sconn);
266 | conn.Open();
267 | IDbCommand cmd = null;
268 | try
269 | {
270 | cmd = new MySqlCommand(@"select * from tables where table_schema = '" + e.Node.Text +"'", (MySqlConnection)conn);
271 | cmd.CommandType = CommandType.Text;
272 | MySqlDataReader dr = null;
273 | try
274 | {
275 | dr = ((MySqlCommand)cmd).ExecuteReader();
276 | if (null != dr)
277 | {
278 | // dgv.ColumnCount = 3;
279 | dgv.AutoGenerateColumns = false;
280 | dgv.Columns.Clear();
281 |
282 | DataGridViewColumn cl = new DataGridViewTextBoxColumn();
283 | //DataGridViewColumn column = new DataGridViewTextBoxColumn();
284 | //column.DataPropertyName = "Name";
285 | cl.Name = "表名";
286 | dgv.Columns.Add(cl);
287 |
288 | cl = new DataGridViewTextBoxColumn();
289 | //column.DataPropertyName = "Name";
290 | cl.Name = "类名";
291 | dgv.Columns.Add(cl);
292 |
293 | //dgv.Columns[0].Name = "选择";
294 | //dgv.Columns[1].Name = "表名";
295 | //dgv.Columns[2].Name = "类名";
296 |
297 |
298 | while (dr.Read())
299 | {
300 | String tbName = dr.GetString("table_name");
301 | DataGridViewRow row = new DataGridViewRow();
302 | //DataGridViewCheckBoxCell cbx = new DataGridViewCheckBoxCell();
303 | //row.Cells.Add(cbx);
304 | //cbx.
305 | DataGridViewTextBoxCell tbx = new DataGridViewTextBoxCell();
306 | row.Cells.Add(tbx);
307 | tbx.ReadOnly = true;
308 | tbx.Value = tbName;
309 |
310 | DataGridViewTextBoxCell tbx2 = new DataGridViewTextBoxCell();
311 | tbx2.Value = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(tbName);
312 | row.Cells.Add(tbx2);
313 | dgv.Rows.Add(row);
314 |
315 | }
316 | }
317 | DataGridViewColumn column = new DataGridViewCheckBoxColumn();
318 |
319 | column = new DataGridViewCheckBoxColumn();
320 | column.Name = "选择";
321 | dgv.Columns.Insert(0,column);
322 | }
323 | catch (Exception e2)
324 | {
325 | MessageBox.Show(e2.Message);
326 | }
327 | finally
328 | {
329 | if (null != dr)
330 | {
331 | dr.Close();
332 | }
333 | }
334 | }
335 | catch (Exception e1)
336 | {
337 | MessageBox.Show(e1.Message);
338 | }
339 | finally
340 | {
341 | if (null != cmd)
342 | cmd.Dispose();
343 | }
344 |
345 | }
346 | catch (Exception exc)
347 | {
348 | MessageBox.Show(exc.Message);
349 | }
350 | finally
351 | {
352 | if (null != conn)
353 | {
354 | conn.Close();
355 | }
356 | }
357 |
358 |
359 |
360 | break;
361 | case DbStyle.SqlServer:
362 | break;
363 | case DbStyle.Oracle:
364 | break;
365 | default:
366 | break;
367 | }
368 | }
369 |
370 | private void makeFile(string path,string ifpkg,string clpkg,string dbname,string tname,string defclassname,StringBuilder sbxml)
371 | {
372 | string sSysDatabase = "information_schema";
373 | string sconn = makeConnectString(sSysDatabase);
374 | IDbConnection conn = null;
375 | try
376 | {
377 | string ifname = "I" + defclassname;
378 | StringBuilder ifsb = new StringBuilder();
379 | ifsb.Append("package ").Append(ifpkg).AppendLine(";");
380 | ifsb.AppendLine();
381 | ifsb.AppendLine("import org.albianj.persistence.object.IAlbianObject;");
382 | ifsb.AppendLine();
383 | ifsb.Append("public interface ").Append(ifname).Append(" extends IAlbianObject { ").AppendLine();
384 | ifsb.AppendLine();
385 |
386 | StringBuilder clsb = new StringBuilder();
387 | clsb.Append("package ").Append(clpkg).AppendLine(";");
388 | clsb.AppendLine();
389 | clsb.AppendLine("import org.albianj.persistence.object.FreeAlbianObject;");
390 | clsb.Append("import ").Append(ifpkg).Append(".").Append(ifname).AppendLine(";");
391 | clsb.AppendLine();
392 | clsb.Append("public class ").Append(defclassname)
393 | .Append(" extends FreeAlbianObject implements ").
394 | Append(ifname).Append(" { ").AppendLine();
395 | clsb.AppendLine();
396 |
397 | sbxml.AppendFormat(" ")
399 | .AppendLine(" ")
400 | .AppendLine(" ");
401 |
402 |
403 |
404 |
405 |
406 | conn = new MySqlConnection(sconn);
407 | conn.Open();
408 | IDbCommand cmd = null;
409 | try
410 | {
411 | cmd = new MySqlCommand(@"select * from columns where table_schema ='" + dbname +"' and table_name ='" + tname + "'", (MySqlConnection)conn);
412 | cmd.CommandType = CommandType.Text;
413 | MySqlDataReader dr = null;
414 | try
415 | {
416 | dr = ((MySqlCommand)cmd).ExecuteReader();
417 | if (null != dr)
418 | {
419 | while (dr.Read())
420 | {
421 | string column = dr.GetString("column_name");
422 | string dtype = dr.GetString("data_type");
423 | string ctype = dr.GetString("column_type");
424 | string ckey = dr.GetString("column_key");
425 | string arg = char.ToLower(column[0]) + column.Substring(1);
426 |
427 | ifsb.Append(" public ").Append(dataTypeToJavaType(dtype, ctype))
428 | .Append(" get").Append(Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(column))
429 | .Append("();").AppendLine()
430 | .Append(" public void set").Append(Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(column))
431 | .Append("(").Append(dataTypeToJavaType(dtype, ctype)).Append(" ").Append(arg).Append(");")
432 | .AppendLine()
433 | .AppendLine();
434 |
435 | clsb.Append(" private ").Append(dataTypeToJavaType(dtype, ctype))
436 | .Append(" _").Append(arg).Append(";").AppendLine()
437 | .Append(" public ").Append(dataTypeToJavaType(dtype, ctype))
438 | .Append(" get").Append(Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(column))
439 | .Append("(){").AppendLine()
440 | .Append(" return this._").Append(arg).AppendLine(";")
441 | .AppendLine(" }")
442 | .Append(" public void set").Append(Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(column))
443 | .Append("(").Append(dataTypeToJavaType(dtype, ctype)).Append(" ").Append(arg).AppendLine("){ ")
444 | .Append(" this._").Append(arg).Append(" = ").Append(arg).AppendLine(";")
445 | .AppendLine(" }")
446 | .AppendLine();
447 |
448 |
449 | if(ckey.ToUpper().Equals("PRI"))
450 | {
451 | sbxml.AppendFormat(" ",
452 | Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(column),column
453 | ).AppendLine();
454 | } else
455 | {
456 | sbxml.AppendFormat(" ",
457 | Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(column), column
458 | ).AppendLine();
459 | }
460 |
461 |
462 |
463 | }
464 |
465 | ifsb.AppendLine("}");
466 | clsb.AppendLine("}");
467 | sbxml.AppendLine(" ");
468 | sbxml.AppendLine(" ");
469 |
470 | }
471 |
472 | string ifpath = path +"\\data\\"+ ifname + ".java";
473 | string cpath = path + "\\data\\"+ defclassname + ".java";
474 | File.WriteAllText(ifpath, ifsb.ToString());
475 | File.WriteAllText(cpath, clsb.ToString());
476 |
477 |
478 | }
479 | catch (Exception e2)
480 | {
481 |
482 | }
483 | finally
484 | {
485 | if (null != dr)
486 | {
487 | dr.Close();
488 | }
489 | }
490 | }
491 | catch (Exception e1)
492 | {
493 |
494 | }
495 | finally
496 | {
497 | if (null != cmd)
498 | cmd.Dispose();
499 | }
500 |
501 |
502 |
503 | }
504 | catch (Exception e)
505 | {
506 |
507 | }
508 | finally
509 | {
510 | if (null != conn)
511 | {
512 | conn.Close();
513 | }
514 | }
515 | }
516 |
517 | private string dataTypeToJavaType(string dtype,string columnType)
518 | {
519 | switch (dtype.Trim().ToLower()) {
520 | case "varchar":
521 | case "char":
522 | case "text":
523 | {
524 | return "String";
525 | }
526 | case "blob":
527 | {
528 | return "byte[]";
529 | }
530 | case "int":
531 | {
532 | if (columnType.Contains("unsigned"))
533 | {
534 | return "long";
535 | }
536 | return "int";
537 | }
538 | case "tinyint":
539 | case "smallint":
540 | case "mediumint":
541 | {
542 | return "int";
543 | }
544 | case "bit":
545 | {
546 | return "boolean";
547 | }
548 | case "bigint":
549 | {
550 | return "java.math.BigInteger";
551 | }
552 | case "float":
553 | {
554 | return "float";
555 | }
556 | case "double":
557 | {
558 | return "double";
559 | }
560 | case "decimal":
561 | {
562 | return "java.math.BigDecimal";
563 | }
564 | case "date":
565 | {
566 | return "java.sql.Date";
567 | }
568 | case "time":
569 | {
570 | return "java.sql.Time";
571 | }
572 | case "datetime":
573 | case "timestamp":
574 | {
575 | return "java.sql.Timestamp";
576 | }
577 | default:
578 | {
579 | return "String";
580 | }
581 | }
582 | }
583 |
584 |
585 |
586 |
587 |
588 |
589 | }
590 |
591 |
592 |
593 | }
594 |
--------------------------------------------------------------------------------