Skip to content

Commit e4bc9ff

Browse files
committed
Follow up #2179 #2180 : Enable validation of DI scopes everywhere.
* OcelotBuilderExtensionsTests for Eureka SD * BuildServiceProvider(true) #2179 (comment) * Add TestHostBuilder with enabled scopes validation by default across all testing projects #2179 (comment) * Update Sample projects with force scopes validation. Add Ocelot.Samples.Web project. Add OcelotHostBuilder and DownstreamHostBuilder helpers. Add Ocelot.Samples.Web project reference to all samples projects. TargetFramework is `net8.0` only.
1 parent 8b633af commit e4bc9ff

File tree

97 files changed

+958
-871
lines changed

Some content is hidden

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

97 files changed

+958
-871
lines changed

Ocelot.Release.sln

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Tracing.Butterfly",
5252
EndProject
5353
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Tracing.OpenTracing", "src\Ocelot.Tracing.OpenTracing\Ocelot.Tracing.OpenTracing.csproj", "{11C622AD-8C0A-4CF4-811B-3DBB76550797}"
5454
EndProject
55-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "samples", "{8FA0CBA0-0338-48EB-B37F-83CA5022237C}"
55+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{8FA0CBA0-0338-48EB-B37F-83CA5022237C}"
5656
EndProject
5757
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.AdministrationApi", "samples\Administration\Ocelot.Samples.AdministrationApi.csproj", "{A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}"
5858
EndProject
@@ -78,16 +78,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceFabri
7878
EndProject
7979
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceFabric.DownstreamService", "samples\ServiceFabric\DownstreamService\Ocelot.Samples.ServiceFabric.DownstreamService.csproj", "{AD09D124-7DD7-4C9E-9BCC-782B579B1786}"
8080
EndProject
81+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Web", "samples\Web\Ocelot.Samples.Web.csproj", "{1A00E87D-2B0B-4D61-A606-3D747C1E43F8}"
82+
EndProject
8183
Global
8284
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8385
Debug|Any CPU = Debug|Any CPU
8486
Release|Any CPU = Release|Any CPU
8587
EndGlobalSection
8688
GlobalSection(ProjectConfigurationPlatforms) = postSolution
87-
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
88-
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
89-
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
90-
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.Build.0 = Release|Any CPU
9189
{54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
9290
{54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.Build.0 = Debug|Any CPU
9391
{54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -108,6 +106,14 @@ Global
108106
{D4575572-99CA-4530-8737-C296EDA326F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
109107
{D4575572-99CA-4530-8737-C296EDA326F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
110108
{D4575572-99CA-4530-8737-C296EDA326F8}.Release|Any CPU.Build.0 = Release|Any CPU
109+
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
110+
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.Build.0 = Debug|Any CPU
111+
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.ActiveCfg = Release|Any CPU
112+
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.Build.0 = Release|Any CPU
113+
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114+
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
115+
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
116+
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.Build.0 = Release|Any CPU
111117
{F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
112118
{F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
113119
{F69CEF43-27D2-4940-A47A-FCA879E371BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -124,6 +130,10 @@ Global
124130
{9BBD3586-145C-4FA0-91C5-9ED58287D753}.Debug|Any CPU.Build.0 = Debug|Any CPU
125131
{9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|Any CPU.ActiveCfg = Release|Any CPU
126132
{9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|Any CPU.Build.0 = Release|Any CPU
133+
{72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
134+
{72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.Build.0 = Debug|Any CPU
135+
{72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.ActiveCfg = Release|Any CPU
136+
{72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.Build.0 = Release|Any CPU
127137
{1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
128138
{1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
129139
{1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -132,18 +142,10 @@ Global
132142
{6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Debug|Any CPU.Build.0 = Debug|Any CPU
133143
{6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|Any CPU.ActiveCfg = Release|Any CPU
134144
{6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|Any CPU.Build.0 = Release|Any CPU
135-
{72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
136-
{72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.Build.0 = Debug|Any CPU
137-
{72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.ActiveCfg = Release|Any CPU
138-
{72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.Build.0 = Release|Any CPU
139145
{11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
140146
{11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|Any CPU.Build.0 = Debug|Any CPU
141147
{11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|Any CPU.ActiveCfg = Release|Any CPU
142148
{11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|Any CPU.Build.0 = Release|Any CPU
143-
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
144-
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.Build.0 = Debug|Any CPU
145-
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.ActiveCfg = Release|Any CPU
146-
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.Build.0 = Release|Any CPU
147149
{A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
148150
{A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Debug|Any CPU.Build.0 = Debug|Any CPU
149151
{A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -192,26 +194,30 @@ Global
192194
{AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Debug|Any CPU.Build.0 = Debug|Any CPU
193195
{AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Release|Any CPU.ActiveCfg = Release|Any CPU
194196
{AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Release|Any CPU.Build.0 = Release|Any CPU
197+
{1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
198+
{1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
199+
{1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
200+
{1A00E87D-2B0B-4D61-A606-3D747C1E43F8}.Release|Any CPU.Build.0 = Release|Any CPU
195201
EndGlobalSection
196202
GlobalSection(SolutionProperties) = preSolution
197203
HideSolutionNode = FALSE
198204
EndGlobalSection
199205
GlobalSection(NestedProjects) = preSolution
200-
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
201206
{54E84F1A-E525-4443-96EC-039CBD50C263} = {5B401523-36DA-4491-B73A-7590A26E420B}
202207
{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52} = {5B401523-36DA-4491-B73A-7590A26E420B}
203208
{02BBF4C5-517E-4157-8D21-4B8B9E118B7A} = {5B401523-36DA-4491-B73A-7590A26E420B}
204209
{106B49E6-95F6-4A7B-B81C-96BFA74AF035} = {5B401523-36DA-4491-B73A-7590A26E420B}
205210
{D4575572-99CA-4530-8737-C296EDA326F8} = {5B401523-36DA-4491-B73A-7590A26E420B}
211+
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087} = {5B401523-36DA-4491-B73A-7590A26E420B}
212+
{D6DF4206-0DBA-41D8-884D-C3E08290FDBB} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
206213
{F69CEF43-27D2-4940-A47A-FCA879E371BC} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
207214
{EB9F438F-062E-499F-B6EA-4412BEF6D74C} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
208215
{02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
209216
{9BBD3586-145C-4FA0-91C5-9ED58287D753} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
217+
{72C8E528-B4F5-45CE-8A06-CD3787364856} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
210218
{1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
211219
{6045E23D-669C-4F27-AF8E-8EEE6DB3557F} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
212-
{72C8E528-B4F5-45CE-8A06-CD3787364856} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
213220
{11C622AD-8C0A-4CF4-811B-3DBB76550797} = {5CFB79B7-C9DC-45A4-9A75-625D92471702}
214-
{AE6BCCBD-0687-4C58-B30F-4ABBC6422087} = {5B401523-36DA-4491-B73A-7590A26E420B}
215221
{A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C}
216222
{F00C73F4-019D-490D-8194-CA1754D717FA} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C}
217223
{FECB0C8B-5778-4441-B10E-0C815F5106D5} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C}
@@ -224,6 +230,7 @@ Global
224230
{DCBD0AB5-85DD-4F28-9166-0A23969E19EC} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C}
225231
{D991C694-01F0-4F04-8135-5C133DC8E029} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C}
226232
{AD09D124-7DD7-4C9E-9BCC-782B579B1786} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C}
233+
{1A00E87D-2B0B-4D61-A606-3D747C1E43F8} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C}
227234
EndGlobalSection
228235
GlobalSection(ExtensibilityGlobals) = postSolution
229236
SolutionGuid = {21476EFF-778A-4F97-8A56-D1AF1CEC0C48}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
3+
<TargetFramework>net8.0</TargetFramework>
44
<ImplicitUsings>disable</ImplicitUsings>
55
<Nullable>disable</Nullable>
66
</PropertyGroup>
7-
<ItemGroup>
8-
<Folder Include="wwwroot\" />
9-
</ItemGroup>
107
<ItemGroup>
118
<ProjectReference Include="..\..\src\Ocelot.Administration\Ocelot.Administration.csproj" />
129
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
10+
<ProjectReference Include="..\Web\Ocelot.Samples.Web.csproj" />
1311
</ItemGroup>
1412
</Project>

samples/Administration/Program.cs

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,40 @@
44
using Ocelot.Administration;
55
using Ocelot.DependencyInjection;
66
using Ocelot.Middleware;
7-
using System.IO;
7+
using Ocelot.Samples.Web;
88

9-
namespace AdministrationApi
9+
namespace AdministrationApi;
10+
11+
public class Program
1012
{
11-
public class Program
13+
public static void Main(string[] args)
1214
{
13-
public static void Main(string[] args)
14-
{
15-
new WebHostBuilder()
16-
.UseKestrel()
17-
.UseUrls("http://localhost:5000")
18-
.UseContentRoot(Directory.GetCurrentDirectory())
19-
.ConfigureAppConfiguration((hostingContext, config) =>
20-
{
21-
config
22-
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
23-
.AddJsonFile("appsettings.json", true, true)
24-
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
25-
.AddJsonFile("ocelot.json")
26-
.AddEnvironmentVariables();
27-
})
28-
.ConfigureServices(s =>
29-
{
30-
s.AddOcelot()
31-
.AddAdministration("/administration", "secret");
32-
})
33-
.ConfigureLogging((hostingContext, logging) =>
34-
{
35-
logging.AddConsole();
36-
})
37-
.UseIISIntegration()
38-
.Configure(app =>
39-
{
40-
app.UseOcelot().Wait();
41-
})
42-
.Build()
43-
.Run();
44-
}
15+
OcelotHostBuilder.Create(args)
16+
.UseUrls("http://localhost:5000")
17+
.ConfigureAppConfiguration((hostingContext, config) =>
18+
{
19+
config
20+
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
21+
.AddJsonFile("appsettings.json", true, true)
22+
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
23+
.AddJsonFile("ocelot.json")
24+
.AddEnvironmentVariables();
25+
})
26+
.ConfigureServices(s =>
27+
{
28+
s.AddOcelot()
29+
.AddAdministration("/administration", "secret");
30+
})
31+
.ConfigureLogging((hostingContext, logging) =>
32+
{
33+
logging.AddConsole();
34+
})
35+
.UseIISIntegration()
36+
.Configure(app =>
37+
{
38+
app.UseOcelot().Wait();
39+
})
40+
.Build()
41+
.Run();
4542
}
4643
}

samples/Basic/Ocelot.Samples.Basic.ApiGateway.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
3+
<TargetFramework>net8.0</TargetFramework>
44
<ImplicitUsings>disable</ImplicitUsings>
55
<Nullable>disable</Nullable>
66
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
@@ -10,5 +10,6 @@
1010
</ItemGroup>
1111
<ItemGroup>
1212
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
13+
<ProjectReference Include="..\Web\Ocelot.Samples.Web.csproj" />
1314
</ItemGroup>
1415
</Project>

samples/Basic/Program.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
using Microsoft.Extensions.Configuration;
44
using Microsoft.Extensions.Hosting;
55
using Microsoft.Extensions.Logging;
6-
using System.IO;
6+
using Ocelot.Samples.Web;
77

88
namespace Ocelot.Samples.OcelotBasic.ApiGateway;
99

1010
public class Program
1111
{
1212
public static void Main(string[] args)
1313
{
14-
new WebHostBuilder()
15-
.UseKestrel()
16-
.UseContentRoot(Directory.GetCurrentDirectory())
14+
OcelotHostBuilder.BasicSetup()
1715
.ConfigureAppConfiguration((hostingContext, config) =>
1816
{
1917
config

samples/Eureka/ApiGateway/Ocelot.Samples.Eureka.ApiGateway.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
3+
<TargetFramework>net8.0</TargetFramework>
44
<ImplicitUsings>disable</ImplicitUsings>
55
<Nullable>disable</Nullable>
66
</PropertyGroup>
@@ -16,5 +16,6 @@
1616
<ProjectReference Include="..\..\..\src\Ocelot.Provider.Eureka\Ocelot.Provider.Eureka.csproj" />
1717
<ProjectReference Include="..\..\..\src\Ocelot.Provider.Polly\Ocelot.Provider.Polly.csproj" />
1818
<ProjectReference Include="..\..\..\src\Ocelot\Ocelot.csproj" />
19+
<ProjectReference Include="..\..\Web\Ocelot.Samples.Web.csproj" />
1920
</ItemGroup>
2021
</Project>
Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,39 @@
1-
using Microsoft.AspNetCore;
2-
using Microsoft.AspNetCore.Hosting;
1+
using Microsoft.AspNetCore.Hosting;
32
using Microsoft.Extensions.Configuration;
43
using Ocelot.DependencyInjection;
54
using Ocelot.Middleware;
65
using Ocelot.Provider.Eureka;
76
using Ocelot.Provider.Polly;
7+
using Ocelot.Samples.Web;
88

9-
namespace ApiGateway
9+
namespace ApiGateway;
10+
11+
public class Program
1012
{
11-
public class Program
13+
public static void Main(string[] args)
1214
{
13-
public static void Main(string[] args)
14-
{
15-
BuildWebHost(args).Run();
16-
}
17-
18-
public static IWebHost BuildWebHost(string[] args) =>
19-
WebHost.CreateDefaultBuilder(args)
20-
.UseUrls("http://localhost:5000")
21-
.ConfigureAppConfiguration((hostingContext, config) =>
22-
{
23-
config
24-
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
25-
.AddJsonFile("appsettings.json", true, true)
26-
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
27-
.AddJsonFile("ocelot.json", false, false)
28-
.AddEnvironmentVariables();
29-
})
30-
.ConfigureServices(s =>
31-
{
32-
s.AddOcelot()
33-
.AddEureka()
34-
.AddPolly();
35-
})
36-
.Configure(a =>
37-
{
38-
a.UseOcelot().Wait();
39-
})
40-
.Build();
15+
OcelotHostBuilder.Create(args)
16+
.UseUrls("http://localhost:5000")
17+
.ConfigureAppConfiguration((hostingContext, config) =>
18+
{
19+
config
20+
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
21+
.AddJsonFile("appsettings.json", true, true)
22+
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
23+
.AddJsonFile("ocelot.json", false, false)
24+
.AddEnvironmentVariables();
25+
})
26+
.ConfigureServices(s =>
27+
{
28+
s.AddOcelot()
29+
.AddEureka()
30+
.AddPolly();
31+
})
32+
.Configure(a =>
33+
{
34+
a.UseOcelot().Wait();
35+
})
36+
.Build()
37+
.Run();
4138
}
4239
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
3+
<TargetFramework>net8.0</TargetFramework>
44
<ImplicitUsings>disable</ImplicitUsings>
55
<Nullable>disable</Nullable>
66
</PropertyGroup>
7-
<ItemGroup>
8-
<Folder Include="wwwroot\" />
9-
</ItemGroup>
107
<ItemGroup>
118
<PackageReference Include="Steeltoe.Discovery.Client" Version="1.1.0" />
129
</ItemGroup>
1310
<ItemGroup>
1411
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
1512
</ItemGroup>
13+
<ItemGroup>
14+
<ProjectReference Include="..\..\Web\Ocelot.Samples.Web.csproj" />
15+
</ItemGroup>
1616
</Project>
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
using Microsoft.AspNetCore;
22
using Microsoft.AspNetCore.Hosting;
3+
using Ocelot.Samples.Web;
34
using System;
45

5-
namespace DownstreamService
6+
namespace DownstreamService;
7+
8+
public class Program
69
{
7-
public class Program
10+
public static void Main(string[] args)
811
{
9-
public static void Main(string[] args)
10-
{
11-
BuildWebHost(args).Run();
12-
}
13-
14-
public static IWebHost BuildWebHost(string[] args) =>
15-
WebHost.CreateDefaultBuilder(args)
16-
.UseUrls($"http://{Environment.MachineName}:5001")
17-
.UseStartup<Startup>()
18-
.Build();
12+
DownstreamHostBuilder.Create(args)
13+
.UseUrls($"http://{Environment.MachineName}:5001")
14+
.UseStartup<Startup>()
15+
.Build()
16+
.Run();
1917
}
18+
2019
}

samples/GraphQL/Ocelot.Samples.GraphQL.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
3+
<TargetFramework>net8.0</TargetFramework>
44
<ImplicitUsings>disable</ImplicitUsings>
55
<Nullable>disable</Nullable>
66
</PropertyGroup>
@@ -17,5 +17,6 @@
1717
</ItemGroup>
1818
<ItemGroup>
1919
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
20+
<ProjectReference Include="..\Web\Ocelot.Samples.Web.csproj" />
2021
</ItemGroup>
2122
</Project>

0 commit comments

Comments
 (0)