-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-harness.linq
92 lines (84 loc) · 2.73 KB
/
test-harness.linq
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
<Query Kind="FSharpProgram">
<Reference Relative="..\fsdl.test\bin\Debug\net472\fsdl.dll">C:\Src\fsdl\fsdl.test\bin\Debug\net472\fsdl.dll</Reference>
<Reference Relative="..\fsdl.test\bin\Debug\net472\fsdl.test.dll">C:\Src\fsdl\fsdl.test\bin\Debug\net472\fsdl.test.dll</Reference>
<NuGetReference>FSharp.Data</NuGetReference>
<Namespace>fsdl.CodeGeneration</Namespace>
<Namespace>fsdl.test</Namespace>
<Namespace>fsdl.Types</Namespace>
<Namespace>FSharp.Data</Namespace>
<Namespace>FSharp.Data.Runtime</Namespace>
</Query>
let baseColumns =
[
NotNull("CommonDate", DATE, NOW)
NotNull("CommonFKID", INT, VAL(1))
]
let baseConstraints =
[
ForeignKey("CommonFKID", "tCommonFKTable", "ID")
]
let dtoSpec = {
ns = "fsdl.test"
inheritFrom = Some "DTOBase"
interfaces = None
accessModifier = Public
constructor = true
setters = NoSetters
partial = true
dapperAttributes = true
}
let table1 = {
name = "tEntity1"
columns =
[
NotNull("ID", GUID, NEWGUID)
Identity("IDX", INT, 1, 1)
Null("Name", CHR(16))
//NotNull("Index", INT, VAL(100))
NotNull("IsActive", BIT, FALSE)
//Null("TotalPrice", MONEY)
Null("Description", TEXT)
NotNull("FKID", INT, NONE)
//NotNull("EnumProp", ENUM(typeof<TestEnum>), VAL(int TestEnum.A))
]
constraints =
[
PrimaryKey(["ID"])
ForeignKey("FKID", "tFKTable", "ID")
]
indexes =
[
ClusteredUnique(["IDX"])
]
}
let table2 = {
name = "tEntity2"
columns =
[
NotNull("ID", GUID, NEWGUID)
//Identity("IDX", INT, 1, 1)
//Null("Name", CHR(16))
NotNull("Index", INT, VAL(100))
//NotNull("IsActive", BIT, FALSE)
Null("TotalPrice", MONEY)
//Null("Description", TEXT)
//NotNull("FKID", INT, NONE)
NotNull("EnumProp", ENUM(typeof<TestEnum>), VAL(int TestEnum.A))
]
constraints =
[
PrimaryKey(["ID"])
//ForeignKey("FKID", "tFKTable", "ID")
]
indexes =
[
//ClusteredUnique(["IDX"])
]
}
let entity1 = { table = table1; dto = { name = "Entity1"; spec = dtoSpec } }
let entity2 = { table = table2; dto = { name = "Entity2"; spec = dtoSpec } }
let entities = [entity1; entity2]
generateDTOClassDefinitions entities baseColumns |> Console.Write |> ignore
generateTableDefinitions entities baseColumns |> Console.Write |> ignore
generateIndexDefinitions entities |> Console.Write |> ignore
generateConstraintDefinitions entities baseConstraints |> Console.Write |> ignore