Skip to content

Commit

Permalink
File-scoped namespaces everywhere (#2211)
Browse files Browse the repository at this point in the history
* Convert to file-scoped namespace: Ocelot

* Convert to file-scoped namespace: Ocelot.Administration

* Convert to file-scoped namespace: Ocelot.Cache.CacheManager

* Convert to file-scoped namespace: Ocelot.Provider.Kubernetes

* Convert to file-scoped namespace: Ocelot.AcceptanceTests

* Convert to file-scoped namespace: Ocelot.Benchmarks

* Convert to file-scoped namespace: Ocelot.UnitTests

* Convert to file-scoped namespace: Ocelot.IntegrationTests

* Convert to file-scoped namespace: Ocelot.Samples

* Fix namespaces in sample projects
  • Loading branch information
raman-m committed Nov 22, 2024
1 parent d41f8fa commit e9a8bfc
Show file tree
Hide file tree
Showing 497 changed files with 29,364 additions and 29,844 deletions.
2 changes: 1 addition & 1 deletion samples/Administration/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Ocelot.Middleware;
using Ocelot.Samples.Web;

namespace AdministrationApi;
namespace Ocelot.Samples.AdministrationApi;

public class Program
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Basic/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Extensions.Logging;
using Ocelot.Samples.Web;

namespace Ocelot.Samples.OcelotBasic.ApiGateway;
namespace Ocelot.Samples.Basic.ApiGateway;

public class Program
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Basic/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Ocelot.DependencyInjection;
using Ocelot.Middleware;

namespace Ocelot.Samples.OcelotBasic.ApiGateway;
namespace Ocelot.Samples.Basic.ApiGateway;

public class Startup
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Eureka/ApiGateway/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Ocelot.Provider.Polly;
using Ocelot.Samples.Web;

namespace ApiGateway;
namespace Ocelot.Samples.Eureka.ApiGateway;

public class Program
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace DownstreamService.Controllers
namespace Ocelot.Samples.Eureka.DownstreamService.Controllers;

[Route("api/[controller]")]
public class CategoryController : Controller
{
[Route("api/[controller]")]
public class CategoryController : Controller
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new[] { "category1", "category2" };
}
return new[] { "category1", "category2" };
}
}
2 changes: 1 addition & 1 deletion samples/Eureka/DownstreamService/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Ocelot.Samples.Web;
using System;

namespace DownstreamService;
namespace Ocelot.Samples.Eureka.DownstreamService;

public class Program
{
Expand Down
41 changes: 20 additions & 21 deletions samples/Eureka/DownstreamService/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,32 @@
using Microsoft.Extensions.Hosting;
using Steeltoe.Discovery.Client;

namespace DownstreamService
namespace Ocelot.Samples.Eureka.DownstreamService;

public class Startup
{
public class Startup
public Startup(IConfiguration configuration)
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
Configuration = configuration;
}

public IConfiguration Configuration { get; }
public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddDiscoveryClient(Configuration);
services.AddMvc();
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddDiscoveryClient(Configuration);
services.AddMvc();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseDiscoveryClient();
app.UseDeveloperExceptionPage();
}

app.UseDiscoveryClient();
}
}
2 changes: 1 addition & 1 deletion samples/GraphQL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace OcelotGraphQL;
namespace Ocelot.Samples.GraphQL;

public class Hero
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Kubernetes/ApiGateway/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.Extensions.Configuration;
using Ocelot.Samples.Web;

namespace Ocelot.Samples.OcelotKube.ApiGateway;
namespace Ocelot.Samples.Kubernetes.ApiGateway;

public class Program
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Kubernetes/ApiGateway/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Ocelot.Middleware;
using Ocelot.Provider.Kubernetes;

namespace Ocelot.Samples.OcelotKube.ApiGateway;
namespace Ocelot.Samples.Kubernetes.ApiGateway;

public class Startup
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace Ocelot.Samples.OcelotKube.DownstreamService.Controllers;
namespace Ocelot.Samples.Kubernetes.DownstreamService.Controllers;

[ApiController]
[Route("api/[controller]")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Collections.Generic;
using System.Linq;

namespace Ocelot.Samples.OcelotKube.DownstreamService.Controllers;
namespace Ocelot.Samples.Kubernetes.DownstreamService.Controllers;

using Models;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Ocelot.Samples.OcelotKube.DownstreamService.Models;
namespace Ocelot.Samples.Kubernetes.DownstreamService.Models;

public class WeatherForecast
{
Expand Down
2 changes: 1 addition & 1 deletion samples/Kubernetes/DownstreamService/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Ocelot.Samples.OcelotKube.DownstreamService;
namespace Ocelot.Samples.Kubernetes.DownstreamService;

public class Program
{
Expand Down
31 changes: 15 additions & 16 deletions samples/ServiceFabric/ApiGateway/OcelotApplicationApiGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@
using System.Collections.Generic;
using System.Fabric;

namespace OcelotApplicationApiGateway
namespace Ocelot.Samples.ServiceFabric.ApiGateway;

/// Service that handles front-end web requests and acts as a proxy to the back-end data for the UI web page.
/// It is a stateless service that hosts a Web API application on OWIN.
internal sealed class OcelotServiceWebService : StatelessService
{
/// Service that handles front-end web requests and acts as a proxy to the back-end data for the UI web page.
/// It is a stateless service that hosts a Web API application on OWIN.
internal sealed class OcelotServiceWebService : StatelessService
{
public OcelotServiceWebService(StatelessServiceContext context)
: base(context)
{ }
public OcelotServiceWebService(StatelessServiceContext context)
: base(context)
{ }

protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new[]
{
return new[]
{
new ServiceInstanceListener(
initparams => new WebCommunicationListener(string.Empty, initparams),
"OcelotServiceWebListener")
};
}
new ServiceInstanceListener(
initparams => new WebCommunicationListener(string.Empty, initparams),
"OcelotServiceWebListener")
};
}
}
63 changes: 31 additions & 32 deletions samples/ServiceFabric/ApiGateway/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,41 @@
using System.Diagnostics.Tracing;
using System.Threading;

namespace OcelotApplicationApiGateway
namespace Ocelot.Samples.ServiceFabric.ApiGateway;


/// <summary>
/// The service host is the executable that hosts the Service instances.
/// </summary>
public class Program
{
/// <summary>
/// The service host is the executable that hosts the Service instances.
/// </summary>
public class Program
public static void Main(string[] args)
{
public static void Main(string[] args)
// Create Service Fabric runtime and register the service type.
try
{

//Creating a new event listener to redirect the traces to a file
var listener = new ServiceEventListener("OcelotApplicationApiGateway");
listener.EnableEvents(ServiceEventSource.Current, EventLevel.LogAlways, EventKeywords.All);

// The ServiceManifest.XML file defines one or more service type names.
// Registering a service maps a service type name to a .NET type.
// When Service Fabric creates an instance of this service type,
// an instance of the class is created in this host process.
ServiceRuntime
.RegisterServiceAsync("OcelotApplicationApiGatewayType", context => new OcelotServiceWebService(context))
.GetAwaiter()
.GetResult();


// Prevents this host process from terminating so services keep running.
Thread.Sleep(Timeout.Infinite);
}
catch (Exception ex)
{
// Create Service Fabric runtime and register the service type.
try
{

//Creating a new event listener to redirect the traces to a file
var listener = new ServiceEventListener("OcelotApplicationApiGateway");
listener.EnableEvents(ServiceEventSource.Current, EventLevel.LogAlways, EventKeywords.All);

// The ServiceManifest.XML file defines one or more service type names.
// Registering a service maps a service type name to a .NET type.
// When Service Fabric creates an instance of this service type,
// an instance of the class is created in this host process.
ServiceRuntime
.RegisterServiceAsync("OcelotApplicationApiGatewayType", context => new OcelotServiceWebService(context))
.GetAwaiter()
.GetResult();


// Prevents this host process from terminating so services keep running.
Thread.Sleep(Timeout.Infinite);
}
catch (Exception ex)
{
ServiceEventSource.Current.ServiceHostInitializationFailed(ex);
throw;
}
ServiceEventSource.Current.ServiceHostInitializationFailed(ex);
throw;
}
}
}
Loading

0 comments on commit e9a8bfc

Please sign in to comment.