Skip to content

Commit 105188a

Browse files
committed
First impl of MultiDict
1 parent f89d2a1 commit 105188a

File tree

152 files changed

+10664
-10729
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+10664
-10729
lines changed

DoofesZeug.Generators/Src/Documentation/GenerateEntityOverview.cs

+238-239
Large diffs are not rendered by default.

DoofesZeug.Generators/Src/Documentation/GenerateEnumerationsOverview.cs

+103-104
Original file line numberDiff line numberDiff line change
@@ -14,170 +14,169 @@
1414

1515

1616

17-
namespace DoofesZeug.Documentation
17+
namespace DoofesZeug.Documentation;
18+
19+
public static class GenerateEnumerationsOverview
1820
{
19-
public static class GenerateEnumerationsOverview
20-
{
21-
private static readonly string OUTPUTDIRECTORY = @"O:\DoofesZeug\Documentation\Generated\Enumerations";
21+
private static readonly string OUTPUTDIRECTORY = @"O:\DoofesZeug\Documentation\Generated\Enumerations";
2222

23-
private static readonly Type ENTITY_BASE = typeof(Entity);
23+
private static readonly Type ENTITY_BASE = typeof(Entity);
2424

25-
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
25+
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2626

2727

28-
private static void AppendEnum( Type type, StringBuilder sbPUML )
28+
private static void AppendEnum( Type type, StringBuilder sbPUML )
29+
{
30+
sbPUML.AppendLine();
31+
sbPUML.AppendLine($"enum {type.Name} {{");
32+
33+
foreach( object value in Enum.GetValues(type) )
2934
{
30-
sbPUML.AppendLine();
31-
sbPUML.AppendLine($"enum {type.Name} {{");
35+
sbPUML.AppendLine($" {value}");
36+
}
3237

33-
foreach( object value in Enum.GetValues(type) )
34-
{
35-
sbPUML.AppendLine($" {value}");
36-
}
38+
sbPUML.AppendLine("}");
39+
sbPUML.AppendLine();
40+
}
3741

38-
sbPUML.AppendLine("}");
39-
sbPUML.AppendLine();
40-
}
4142

43+
private static void GenerateUmlDiagramm( Type type, StringBuilder sb )
44+
{
45+
string strOutputDirectory = $"{OUTPUTDIRECTORY}\\{type.Namespace}";
46+
string strDiagrammFilenamePng = $"{type.Name}.png";
47+
string strDiagrammFilenamePuml = $"{type.Name}.puml";
4248

43-
private static void GenerateUmlDiagramm( Type type, StringBuilder sb )
44-
{
45-
string strOutputDirectory = $"{OUTPUTDIRECTORY}\\{type.Namespace}";
46-
string strDiagrammFilenamePng = $"{type.Name}.png";
47-
string strDiagrammFilenamePuml = $"{type.Name}.puml";
49+
//---------------------------------------------------------------------------------------------------------
4850

49-
//---------------------------------------------------------------------------------------------------------
51+
sb.AppendLine();
52+
sb.AppendLine($"![{strDiagrammFilenamePng}](./{strDiagrammFilenamePng} \"{type.Name}\")");
5053

51-
sb.AppendLine();
52-
sb.AppendLine($"![{strDiagrammFilenamePng}](./{strDiagrammFilenamePng} \"{type.Name}\")");
54+
//---------------------------------------------------------------------------------------------------------
5355

54-
//---------------------------------------------------------------------------------------------------------
56+
StringBuilder sbPUML = new(8192);
5557

56-
StringBuilder sbPUML = new(8192);
58+
sbPUML.AppendLine("@startuml");
59+
sbPUML.AppendLine("hide empty members");
60+
sbPUML.AppendLine("skinparam monochrome true");
61+
sbPUML.AppendLine("skinparam backgroundcolor transparent");
5762

58-
sbPUML.AppendLine("@startuml");
59-
sbPUML.AppendLine("hide empty members");
60-
sbPUML.AppendLine("skinparam monochrome true");
61-
sbPUML.AppendLine("skinparam backgroundcolor transparent");
63+
//---------------------------------------------
6264

63-
//---------------------------------------------
65+
AppendEnum(type, sbPUML);
6466

65-
AppendEnum(type, sbPUML);
67+
//---------------------------------------------
6668

67-
//---------------------------------------------
69+
sbPUML.AppendLine("@enduml");
6870

69-
sbPUML.AppendLine("@enduml");
71+
//---------------------------------------------------------------------------------------------------------
7072

71-
//---------------------------------------------------------------------------------------------------------
73+
string strOutputFilename = $"{strOutputDirectory}\\{strDiagrammFilenamePuml}";
74+
File.WriteAllTextAsync(strOutputFilename, sbPUML.ToString(), Encoding.UTF8);
75+
GeneratorTool.PlantUml(strOutputFilename);
76+
}
7277

73-
string strOutputFilename = $"{strOutputDirectory}\\{strDiagrammFilenamePuml}";
74-
File.WriteAllTextAsync(strOutputFilename, sbPUML.ToString(), Encoding.UTF8);
75-
GeneratorTool.PlantUml(strOutputFilename);
76-
}
78+
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7779

78-
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
7980

81+
private static void GenerateEnumerationFile( Type type )
82+
{
83+
string strOutputDirectory = $"{OUTPUTDIRECTORY}\\{type.Namespace}";
8084

81-
private static void GenerateEnumerationFile( Type type )
85+
if( Directory.Exists(strOutputDirectory) == false )
8286
{
83-
string strOutputDirectory = $"{OUTPUTDIRECTORY}\\{type.Namespace}";
87+
Directory.CreateDirectory(strOutputDirectory);
88+
}
8489

85-
if( Directory.Exists(strOutputDirectory) == false )
86-
{
87-
Directory.CreateDirectory(strOutputDirectory);
88-
}
90+
//---------------------------------------------------------------------------------------------------------
8991

90-
//---------------------------------------------------------------------------------------------------------
92+
Out.WriteLineAsync($"Create markdown for: {type.FullName}");
9193

92-
Out.WriteLineAsync($"Create markdown for: {type.FullName}");
94+
StringBuilder sb = new(8192);
9395

94-
StringBuilder sb = new(8192);
96+
sb.AppendLine($"# {type.Name}");
97+
sb.AppendLine();
9598

96-
sb.AppendLine($"# {type.Name}");
97-
sb.AppendLine();
99+
sb.AppendLine($"## Diagram");
100+
GenerateUmlDiagramm(type, sb);
98101

99-
sb.AppendLine($"## Diagram");
100-
GenerateUmlDiagramm(type, sb);
102+
//---------------------------------------------------------------------------------------------------------
101103

102-
//---------------------------------------------------------------------------------------------------------
104+
sb.AppendLine();
105+
sb.AppendLine("<hr style=\"background: blue;\" />");
103106

104-
sb.AppendLine();
105-
sb.AppendLine("<hr style=\"background: blue;\" />");
107+
File.WriteAllTextAsync($"{strOutputDirectory}\\{type.Name}.md", sb.ToString(), Encoding.UTF8);
108+
}
106109

107-
File.WriteAllTextAsync($"{strOutputDirectory}\\{type.Name}.md", sb.ToString(), Encoding.UTF8);
108-
}
109110

111+
private static void GenerateEnumerationOverviewFile( List<Type> enumerations )
112+
{
113+
StringBuilder sb = new(8192);
114+
sb.AppendLine("# Enumerations Overview");
110115

111-
private static void GenerateEnumerationOverviewFile( List<Type> enumerations )
116+
foreach( IGrouping<string, Type> enumerationgroup in from enumeration in enumerations group enumeration by enumeration.Namespace into ng orderby ng.Key select ng )
112117
{
113-
StringBuilder sb = new(8192);
114-
sb.AppendLine("# Enumerations Overview");
118+
sb.AppendLine("");
119+
sb.AppendLine("");
120+
sb.AppendLine($"## `{enumerationgroup.Key}`");
121+
sb.AppendLine("");
115122

116-
foreach( IGrouping<string, Type> enumerationgroup in from enumeration in enumerations group enumeration by enumeration.Namespace into ng orderby ng.Key select ng )
117-
{
118-
sb.AppendLine("");
119-
sb.AppendLine("");
120-
sb.AppendLine($"## `{enumerationgroup.Key}`");
121-
sb.AppendLine("");
123+
sb.AppendLine("|Enumeration|Description|Values|");
124+
sb.AppendLine("|:----------|:----------|:-----|");
122125

123-
sb.AppendLine("|Enumeration|Description|Values|");
124-
sb.AppendLine("|:----------|:----------|:-----|");
126+
string strPath = enumerationgroup.Key [11..].Replace('.', '/');
125127

126-
string strPath = enumerationgroup.Key [11..].Replace('.', '/');
128+
foreach( Type enumeration in from type in enumerationgroup orderby type.Name select type )
129+
{
130+
DescriptionAttribute da = (DescriptionAttribute) enumeration.GetCustomAttribute(typeof(DescriptionAttribute));
127131

128-
foreach( Type enumeration in from type in enumerationgroup orderby type.Name select type )
132+
if( da == null )
129133
{
130-
DescriptionAttribute da = (DescriptionAttribute) enumeration.GetCustomAttribute(typeof(DescriptionAttribute));
131-
132-
if( da == null )
133-
{
134-
throw new Exception($"{enumeration.FullName} have no description!");
135-
}
134+
throw new Exception($"{enumeration.FullName} have no description!");
135+
}
136136

137-
da.Validate(enumeration);
137+
da.Validate(enumeration);
138138

139-
string strLinkToMarkdown = $"[{enumeration.Name}](./{enumerationgroup.Key}/{enumeration.Name}.md)";
139+
string strLinkToMarkdown = $"[{enumeration.Name}](./{enumerationgroup.Key}/{enumeration.Name}.md)";
140140

141-
sb.AppendLine($"|{strLinkToMarkdown}|{da.Description}|{Enum.GetNames(enumeration).ToFlatString()}|");
142-
}
141+
sb.AppendLine($"|{strLinkToMarkdown}|{da.Description}|{Enum.GetNames(enumeration).ToFlatString()}|");
143142
}
143+
}
144144

145-
sb.AppendLine();
146-
sb.AppendLine("<hr style=\"background: blue;\" />");
145+
sb.AppendLine();
146+
sb.AppendLine("<hr style=\"background: blue;\" />");
147147

148-
File.WriteAllTextAsync($"{OUTPUTDIRECTORY}\\README.md", sb.ToString(), Encoding.UTF8);
149-
}
148+
File.WriteAllTextAsync($"{OUTPUTDIRECTORY}\\README.md", sb.ToString(), Encoding.UTF8);
149+
}
150150

151-
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
151+
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
152152

153153

154-
public static void Generate()
155-
{
156-
Assembly assembly = ENTITY_BASE.Assembly;
154+
public static void Generate()
155+
{
156+
Assembly assembly = ENTITY_BASE.Assembly;
157157

158-
Out.WriteLineAsync();
159-
Out.WriteLineAsync($"{assembly.FullName}");
158+
Out.WriteLineAsync();
159+
Out.WriteLineAsync($"{assembly.FullName}");
160160

161-
new DirectoryInfo(OUTPUTDIRECTORY).DeleteDirectoryContentRecursiv(ex => Error.WriteLineAsync(ex.Message));
161+
new DirectoryInfo(OUTPUTDIRECTORY).DeleteDirectoryContentRecursiv(ex => Error.WriteLineAsync(ex.Message));
162162

163-
//---------------------------------------------------------------------------------------------------------
163+
//---------------------------------------------------------------------------------------------------------
164164

165-
List<Type> enumerations = new();
165+
List<Type> enumerations = new();
166166

167-
foreach( Type type in assembly.ExportedTypes )
167+
foreach( Type type in assembly.ExportedTypes )
168+
{
169+
if( type.IsEnum == false )
168170
{
169-
if( type.IsEnum == false )
170-
{
171-
continue;
172-
}
173-
enumerations.Add(type);
171+
continue;
174172
}
173+
enumerations.Add(type);
174+
}
175175

176-
//---------------------------------------------------------------------------------------------------------
176+
//---------------------------------------------------------------------------------------------------------
177177

178-
enumerations.ForEach(enumeration => GenerateEnumerationFile(enumeration));
178+
enumerations.ForEach(enumeration => GenerateEnumerationFile(enumeration));
179179

180-
GenerateEnumerationOverviewFile(enumerations);
181-
}
180+
GenerateEnumerationOverviewFile(enumerations);
182181
}
183182
}

DoofesZeug.Generators/Src/Examples/Entities/PersonExample.cs

+40-41
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,49 @@
77

88

99

10-
namespace DoofesZeug.Examples.Entities
10+
namespace DoofesZeug.Examples.Entities;
11+
12+
public static class PersonExample
1113
{
12-
public static class PersonExample
14+
public static void CreatePerson()
1315
{
14-
public static void CreatePerson()
16+
Person p = new Person
1517
{
16-
Person p = new Person
18+
FirstName = "John",
19+
LastName = "Doe",
20+
Gender = Gender.Male,
21+
22+
DateOfBirth = (11, 02, 1942),
23+
DateOfDeath = (22, 03, 1942 + 42),
24+
25+
Handedness = Handedness.Left,
26+
BloodGroup = BloodGroup.AB,
27+
HairColor = WellKnownHairColor.Blond,
28+
Religion = MajorReligion.Buddhism,
29+
Profession = WellKnownProfession.Engineer,
30+
DriverLicense = EuropeanDriverLicense.B | EuropeanDriverLicense.AM,
31+
32+
AverageHeight = 174,
33+
AverageWeight = 72,
34+
35+
Phone = new Phone
36+
{
37+
Number = "+49 54321 424269",
38+
PhoneType = PhoneType.Landline,
39+
InformationType = InformationType.Private
40+
},
41+
EMailAddress = new EMailAddress
1742
{
18-
FirstName = "John",
19-
LastName = "Doe",
20-
Gender = Gender.Male,
21-
22-
DateOfBirth = (11, 02, 1942),
23-
DateOfDeath = (22, 03, 1942 + 42),
24-
25-
Handedness = Handedness.Left,
26-
BloodGroup = BloodGroup.AB,
27-
HairColor = WellKnownHairColor.Blond,
28-
Religion = MajorReligion.Buddhism,
29-
Profession = WellKnownProfession.Engineer,
30-
DriverLicense = EuropeanDriverLicense.B | EuropeanDriverLicense.AM,
31-
32-
AverageHeight = 174,
33-
AverageWeight = 72,
34-
35-
Phone = new Phone
36-
{
37-
Number = "+49 54321 424269",
38-
PhoneType = PhoneType.Landline,
39-
InformationType = InformationType.Private
40-
},
41-
EMailAddress = new EMailAddress
42-
{
43-
Address = "[email protected]",
44-
InformationType = InformationType.Business
45-
},
46-
Homepage = new Homepage
47-
{
48-
Url = new("https://github.com/ObiWanLansi"),
49-
InformationType = InformationType.Business
50-
}
51-
};
52-
53-
Console.Out.WriteLineAsync(p.ToStringTable());
54-
}
43+
Address = "[email protected]",
44+
InformationType = InformationType.Business
45+
},
46+
Homepage = new Homepage
47+
{
48+
Url = new("https://github.com/ObiWanLansi"),
49+
InformationType = InformationType.Business
50+
}
51+
};
52+
53+
Console.Out.WriteLineAsync(p.ToStringTable());
5554
}
5655
}

0 commit comments

Comments
 (0)