forked from NewLifeX/X
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelSchema.xsd
More file actions
445 lines (431 loc) · 14.9 KB
/
ModelSchema.xsd
File metadata and controls
445 lines (431 loc) · 14.9 KB
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
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
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Model2022"
targetNamespace="http://www.newlifex.com/Model2022.xsd"
elementFormDefault="qualified"
xmlns="http://www.newlifex.com/Model2022.xsd"
xmlns:mstns="http://www.newlifex.com/Model2022.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
新生命Xml模型文件架构说明
</xs:documentation>
</xs:annotation>
<xs:element name="Tables" type="TablesType"></xs:element>
<xs:complexType name="TablesType">
<xs:sequence>
<xs:element name="Table" type="TableType" maxOccurs="unbounded" ></xs:element>
</xs:sequence>
<xs:attribute name="NameSpace" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
实体类的命名空间
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ConnName" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
实体类的数据库连接名
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Output" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
输出目录,绝对或相对地址,相对模型文件所在目录
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="BaseClass" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
实体类的基类
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ChineseFileName" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
是否使用中文作为实体类文件名
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ModelClass" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
简易模型类名称,如{name}Model。指定后将生成简易模型类,可用于数据传输
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ModelInterface" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
简易模型接口名称,如{name}Model。指定后将生成简易模型接口,可用于数据传输
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="NameFormat" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
数据库名称格式,可选 Default/Upper/Lower/Underline
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Version" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
XCode版本
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Document" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
文档教程
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!--Table-start-->
<xs:complexType name="TableType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
一个Table就是一个实体类,对应一张数据表
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Columns" type="ColumnsType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
属性/字段列表
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Indexes" type="IndexesType" minOccurs="0">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
索引列表,并根据列名生成拓展查询方法
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="Name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
生成的实体类名,TableName对应数据库表名,TableName为空则用此属性作为表名
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="TableName" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
数据库表名,为空则默认为Name
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="BaseType" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
基类
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Owner" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
所有者
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ConnName" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
连接名
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DbType" type="DbTypeType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
数据库类型
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IsView" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
是否视图
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisplayName" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
显示名。如果有Description则使用Description,否则使用Name
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Description" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
表描述
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="InsertOnly" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
仅插入数据,比如日志型
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ModelClass" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
简易模型类名称,如{name}Model。指定后将生成简易模型类,可用于数据传输
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ModelInterface" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
简易模型接口名称,如{name}Model。指定后将生成简易模型接口,可用于数据传输
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!--Table-end-->
<xs:simpleType name="DbTypeType">
<xs:annotation>
<xs:documentation>
数据库类型,生成数据库表的是时候会针对数据库类型做处理
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="Access" ></xs:enumeration>
<xs:enumeration value="SqlServer" ></xs:enumeration>
<xs:enumeration value="Oracle" ></xs:enumeration>
<xs:enumeration value="MySql" ></xs:enumeration>
<xs:enumeration value="SqlCe" ></xs:enumeration>
<xs:enumeration value="SQLite" ></xs:enumeration>
<xs:enumeration value="PostgreSQL" ></xs:enumeration>
<xs:enumeration value="DaMeng" ></xs:enumeration>
<xs:enumeration value="DB2" ></xs:enumeration>
<xs:enumeration value="TDengine" ></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ColumnsType">
<xs:sequence>
<xs:element name="Column" type="ColumnType" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
<!--Column-start-->
<xs:complexType name="ColumnType">
<xs:attribute name="Name" type="xs:string">
<xs:annotation>
<xs:documentation>
名称,对应实体类属性名,ColumnName为空时使用该名称
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ColumnName" type="xs:string">
<xs:annotation>
<xs:documentation>
列名
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DataType" type="DataTypeType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
数据类型,对应C#的类型
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="RawType" type="xs:string">
<xs:annotation>
<xs:documentation>
原始数据类型,当且仅当目标数据库同为该数据库类型时,采用实体属性信息上的RawType作为反向工程的目标字段类型,以期获得开发和生产的最佳兼容。
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Identity" type="BooleanType">
<xs:annotation>
<xs:documentation>
自增标识。使用雪花Id时不要设置
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PrimaryKey" type="BooleanType">
<xs:annotation>
<xs:documentation>
主键
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Master" type="xs:string">
<xs:annotation>
<xs:documentation>
主字段。主字段作为业务主要字段,代表当前数据行意义
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Length" type="xs:int">
<xs:annotation>
<xs:documentation>
长度,字符串-1表示无限大
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Precision" type="xs:int">
<xs:annotation>
<xs:documentation>
精度
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Scale" type="xs:int">
<xs:annotation>
<xs:documentation>
位数
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Nullable" type="BooleanType">
<xs:annotation>
<xs:documentation>
允许空
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisplayName" type="xs:string">
<xs:annotation>
<xs:documentation>
显示名。如果有Description则使用Description,否则使用Name
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Description" type="xs:string">
<xs:annotation>
<xs:documentation>
说明
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Type" type="xs:string">
<xs:annotation>
<xs:documentation>
生成自定义类型,比如枚举,值可以是类型名也可以是命名空间+类型名
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Attribute" type="xs:string">
<xs:annotation>
<xs:documentation>
数据属性的特性,例如忽略序列化的XmlIgnore,ScriptIgnore,IgnoreDataMember,支持{name}替换属性名
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ItemType" type="ItemTypeType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
元素类型,用于魔方表单展示
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Model" type="BooleanType">
<xs:annotation>
<xs:documentation>
在简易接口和模型类中是否使用该属性
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!--Column-end-->
<!--BooleanType-start-->
<xs:simpleType name="BooleanType">
<xs:restriction base="xs:string">
<xs:enumeration value="True" ></xs:enumeration>
<xs:enumeration value="False" ></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<!--BooleanType-end-->
<!--DataType-start-->
<xs:simpleType name="DataTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="Boolean" ></xs:enumeration>
<xs:enumeration value="SByte" ></xs:enumeration>
<xs:enumeration value="Byte" ></xs:enumeration>
<xs:enumeration value="Int16" ></xs:enumeration>
<xs:enumeration value="UInt16" ></xs:enumeration>
<xs:enumeration value="UInt16" ></xs:enumeration>
<xs:enumeration value="Int32" ></xs:enumeration>
<xs:enumeration value="UInt32" ></xs:enumeration>
<xs:enumeration value="Int64" ></xs:enumeration>
<xs:enumeration value="UInt64" ></xs:enumeration>
<xs:enumeration value="Single" ></xs:enumeration>
<xs:enumeration value="Double" ></xs:enumeration>
<xs:enumeration value="Decimal" ></xs:enumeration>
<xs:enumeration value="DateTime" ></xs:enumeration>
<xs:enumeration value="String" ></xs:enumeration>
<xs:enumeration value="Byte[]" ></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<!--DataType-end-->
<!--ItemType-start-->
<xs:simpleType name="ItemTypeType">
<xs:restriction base="xs:string">
<xs:enumeration value="image" ></xs:enumeration>
<xs:enumeration value="file" ></xs:enumeration>
<xs:enumeration value="html" ></xs:enumeration>
<xs:enumeration value="mail" ></xs:enumeration>
<xs:enumeration value="mobile" ></xs:enumeration>
<xs:enumeration value="phone" ></xs:enumeration>
<xs:enumeration value="url" ></xs:enumeration>
</xs:restriction>
</xs:simpleType>
<!--ItemType-end-->
<xs:complexType name="IndexesType">
<xs:sequence>
<xs:element name="Index" type="IndexType" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
<!--Index-start-->
<xs:complexType name="IndexType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
索引,同时生成对应的拓展查询方法
</xs:documentation>
</xs:annotation>
<xs:attribute name="Name">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
索引名
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Columns" use="required">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
列名,英文逗号字符相隔,比如:ID,Name
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unique" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
是否唯一
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PrimaryKey" type="BooleanType">
<xs:annotation>
<xs:documentation xml:lang="zh-cn">
是否主键
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!--Index-end-->
</xs:schema>