Skip to content

Commit a0dd84a

Browse files
authored
migrated templates to newest version of thor (#12)
1 parent 0f0320c commit a0dd84a

10 files changed

+61
-52
lines changed

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "2.0.0"
3+
"version": "2.1.301"
44
}
55
}

src/Generator.Tests/EventSourceTemplateEngineTests.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,25 @@ public void GenerateCsharpComplexEventSource()
136136
.Be("WriteCore(int eventId, int applicationId, Guid activityId, Guid a, Guid b, string c, string d, string e)");
137137

138138
eventSourceVisitor.ImportedNamespaces.Count.Should()
139-
.Be(8);
139+
.Be(9);
140140
eventSourceVisitor.ImportedNamespaces[0].Should()
141-
.Be("using ChilliCream.Tracing.Abstractions;");
142-
eventSourceVisitor.ImportedNamespaces[1].Should()
143141
.Be("using System;");
142+
eventSourceVisitor.ImportedNamespaces[1].Should()
143+
.Be("using Gen = System.Generic;");
144144
eventSourceVisitor.ImportedNamespaces[2].Should()
145-
.Be("using System.Collections.Generic;");
145+
.Be("using System.Linq;");
146146
eventSourceVisitor.ImportedNamespaces[3].Should()
147-
.Be("using Gen = System.Generic;");
147+
.Be("using static System.Math;");
148148
eventSourceVisitor.ImportedNamespaces[4].Should()
149-
.Be("using System.Linq;");
149+
.Be("using System.Text;");
150150
eventSourceVisitor.ImportedNamespaces[5].Should()
151-
.Be("using static System.Math;");
151+
.Be("using Tasks = System.Threading.Tasks;");
152152
eventSourceVisitor.ImportedNamespaces[6].Should()
153-
.Be("using System.Text;");
153+
.Be("using Thor.Core;");
154154
eventSourceVisitor.ImportedNamespaces[7].Should()
155-
.Be("using Tasks = System.Threading.Tasks;");
155+
.Be("using Thor.Core.Abstractions;");
156+
eventSourceVisitor.ImportedNamespaces[8].Should()
157+
.Be("using Thor.Core.Transmission.Abstractions;");
156158
}
157159

158160
[Fact]

src/Generator.Tests/Generator.Tests.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
<PackageReference Include="moq" Version="4.7.99" />
1616
<PackageReference Include="OpenCover" Version="4.6.519" />
1717
<PackageReference Include="Thor.Analyzer" Version="1.0.4" />
18-
<PackageReference Include="Thor.Core" Version="1.0.0-preview2" />
19-
<PackageReference Include="Thor.Core.Abstractions" Version="1.0.0-preview2" />
2018
<PackageReference Include="xunit" Version="2.3.1" />
2119
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
2220
</ItemGroup>

src/Generator/Generator.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
19+
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
2020
<PackageReference Include="nustache.core" Version="1.0.0-alfa2" />
21-
<PackageReference Include="Thor.Core" Version="1.0.0-preview1" />
22-
<PackageReference Include="Thor.Core.Abstractions" Version="1.0.0-preview1" />
21+
<PackageReference Include="Thor.Core" Version="1.0.0-preview-0004" />
22+
<PackageReference Include="Thor.Core.Transmission.Abstractions" Version="1.0.0-preview-0004" />
2323
</ItemGroup>
2424

2525
<ItemGroup>

src/Generator/Templates/Defaults/CSharpLight.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"packageDependencies": [
77
{
88
"id": "Thor.Core",
9-
"version": "1.0.0-preview2"
9+
"version": "1.0.0-preview-0004"
1010
},
1111
{
12-
"id": "Thor.Core.Abstractions",
13-
"version": "1.0.0-preview2"
12+
"id": "Thor.Core.Transmission.Abstractions",
13+
"version": "1.0.0-preview-0004"
1414
}
1515
],
1616
"Usings": [
@@ -21,7 +21,7 @@
2121
"namespace": "Thor.Core.Abstractions"
2222
},
2323
{
24-
"namespace": "System.Collections.Generic"
24+
"namespace": "Thor.Core.Transmission.Abstractions"
2525
}
2626
]
2727
}

src/Generator/Templates/Defaults/CSharpWithComplex.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,26 @@
33
"baseWriteMethods": [
44
[ "string" ]
55
],
6-
"complexParameter": { "enabled": true, "eventParameterName": "attachmentId" },
6+
"complexParameter": { "enabled": true, "eventParameterName": "attachmentId" },
77
"packageDependencies": [
88
{
9-
"id": "ChilliCream.Tracing.Abstractions",
10-
"version": "1.0.0-preview3"
9+
"id": "Thor.Core",
10+
"version": "1.0.0-preview-0004"
11+
},
12+
{
13+
"id": "Thor.Core.Transmission.Abstractions",
14+
"version": "1.0.0-preview-0004"
1115
}
1216
],
1317
"Usings": [
1418
{
15-
"namespace": "ChilliCream.Tracing.Abstractions"
19+
"namespace": "Thor.Core"
20+
},
21+
{
22+
"namespace": "Thor.Core.Abstractions"
1623
},
1724
{
18-
"namespace": "System.Collections.Generic"
25+
"namespace": "Thor.Core.Transmission.Abstractions"
1926
}
2027
]
2128
}

src/Generator/Templates/Defaults/CSharpWithComplex.mustache

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ namespace {{namespace}}
2929
if (IsEnabled())
3030
{
3131
{{#HasComplexTypeParameters}}
32-
var attachments = new Dictionary<string, Object>{
33-
{{#complexParameters}}
34-
{"{{name}}", {{name}} },
35-
{{/complexParameters}}
36-
};
37-
38-
var attachmentId = AttachmentId.NewId().ToString();
32+
var attachmentId = AttachmentId.NewId();
3933
{{/HasComplexTypeParameters}}
40-
{{name}}(Application.Id, ActivityStack.Id{{#valueparameters}}, {{name}}{{/valueparameters}});
41-
{{#HasComplexTypeParameters}}
42-
AttachmentDispatcher.Instance.Dispatch(attachmentId, attachments);
34+
35+
{{name}}(Application.Id, ActivityStack.Id{{#valueparameters}}, {{name}}{{/valueparameters}});
36+
37+
{{#HasComplexTypeParameters}}
38+
AttachmentDispatcher.Instance.Dispatch(
39+
{{#complexParameters}}
40+
{{^IsFirst}},{{/IsFirst}} AttachmentFactory.Create(attachmentId, "{{name}}", {{name}})
41+
{{/complexParameters}}
42+
);
4343
{{/HasComplexTypeParameters}}
4444
}
4545
}

src/Generator/Templates/Defaults/CSharpWithComplexLight.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"packageDependencies": [
1111
{
1212
"id": "Thor.Core",
13-
"version": "1.0.0-preview2"
13+
"version": "1.0.0-preview-0004"
1414
},
1515
{
16-
"id": "Thor.Core.Abstractions",
17-
"version": "1.0.0-preview2"
16+
"id": "Thor.Core.Transmission.Abstractions",
17+
"version": "1.0.0-preview-0004"
1818
}
1919
],
2020
"Usings": [
@@ -25,7 +25,7 @@
2525
"namespace": "Thor.Core.Abstractions"
2626
},
2727
{
28-
"namespace": "System.Collections.Generic"
28+
"namespace": "Thor.Core.Transmission.Abstractions"
2929
}
3030
]
3131
}

src/Generator/Templates/Defaults/CSharpWithComplexLight.mustache

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,17 @@ namespace {{namespace}}
3333
if (IsEnabled())
3434
{
3535
{{#HasComplexTypeParameters}}
36-
var attachments = new Dictionary<string, Object>{
37-
{{#complexParameters}}
38-
{"{{name}}", {{name}} },
39-
{{/complexParameters}}
40-
};
41-
42-
var atId = AttachmentId.NewId();
43-
var attachmentId = atId.ToString();
36+
var attachmentId = AttachmentId.NewId();
4437
{{/HasComplexTypeParameters}}
45-
{{name}}(Application.Id, ActivityStack.Id{{#valueparameters}}, {{name}}{{/valueparameters}});
46-
{{#HasComplexTypeParameters}}
47-
AttachmentDispatcher.Instance.Dispatch(atId, attachments);
38+
39+
{{name}}(Application.Id, ActivityStack.Id{{#valueparameters}}, {{name}}{{/valueparameters}});
40+
41+
{{#HasComplexTypeParameters}}
42+
AttachmentDispatcher.Instance.Dispatch(
43+
{{#complexParameters}}
44+
{{^IsFirst}},{{/IsFirst}} AttachmentFactory.Create(attachmentId, "{{name}}", {{name}})
45+
{{/complexParameters}}
46+
);
4847
{{/HasComplexTypeParameters}}
4948
}
5049
}

src/Generator/Templates/Defaults/chillicream.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"packageDependencies": [
1111
{
1212
"id": "Thor.Core",
13-
"version": "1.0.0-preview2"
13+
"version": "1.0.0-preview-0004"
1414
},
1515
{
16-
"id": "Thor.Core.Abstractions",
17-
"version": "1.0.0-preview2"
16+
"id": "Thor.Core.Transmission.Abstractions",
17+
"version": "1.0.0-preview-0004"
1818
}
1919
],
2020
"Usings": [
@@ -26,6 +26,9 @@
2626
},
2727
{
2828
"namespace": "System.Collections.Generic"
29+
},
30+
{
31+
"namespace": "Thor.Core.Transmission.Abstractions"
2932
}
3033
]
3134
}

0 commit comments

Comments
 (0)