|
1 | | -using Microsoft.AspNetCore.Builder; |
2 | | -using Microsoft.AspNetCore.Hosting; |
3 | | -using Microsoft.Extensions.Configuration; |
4 | | -using Microsoft.Extensions.DependencyInjection; |
5 | | -using Microsoft.Extensions.Hosting; |
6 | 1 | using Microsoft.OpenApi.Models; |
7 | 2 | using ServiceBusMessaging; |
8 | 3 |
|
9 | | -namespace AspNetCoreServiceBusApi1 |
| 4 | +namespace AspNetCoreServiceBusApi1; |
| 5 | + |
| 6 | +public class Startup |
10 | 7 | { |
11 | | - public class Startup |
| 8 | + public Startup(IConfiguration configuration) |
12 | 9 | { |
13 | | - public Startup(IConfiguration configuration) |
14 | | - { |
15 | | - Configuration = configuration; |
16 | | - } |
| 10 | + Configuration = configuration; |
| 11 | + } |
17 | 12 |
|
18 | | - public IConfiguration Configuration { get; } |
| 13 | + public IConfiguration Configuration { get; } |
19 | 14 |
|
20 | | - public void ConfigureServices(IServiceCollection services) |
21 | | - { |
22 | | - services.AddControllers(); |
| 15 | + public void ConfigureServices(IServiceCollection services) |
| 16 | + { |
| 17 | + services.AddControllers(); |
23 | 18 |
|
24 | | - services.AddScoped<ServiceBusSender>(); |
25 | | - services.AddScoped<ServiceBusTopicSender>(); |
| 19 | + services.AddScoped<ServiceBusSender>(); |
| 20 | + services.AddScoped<ServiceBusTopicSender>(); |
26 | 21 |
|
27 | | - services.AddSwaggerGen(c => |
| 22 | + services.AddSwaggerGen(c => |
| 23 | + { |
| 24 | + c.SwaggerDoc("v1", new OpenApiInfo |
28 | 25 | { |
29 | | - c.SwaggerDoc("v1", new OpenApiInfo |
30 | | - { |
31 | | - Version = "v1", |
32 | | - Title = "Payload View API", |
33 | | - }); |
| 26 | + Version = "v1", |
| 27 | + Title = "Payload View API", |
34 | 28 | }); |
35 | | - } |
| 29 | + }); |
| 30 | + } |
36 | 31 |
|
37 | | - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
| 32 | + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
| 33 | + { |
| 34 | + if (env.IsDevelopment()) |
38 | 35 | { |
39 | | - if (env.IsDevelopment()) |
40 | | - { |
41 | | - app.UseDeveloperExceptionPage(); |
42 | | - } |
43 | | - else |
44 | | - { |
45 | | - app.UseHsts(); |
46 | | - } |
| 36 | + app.UseDeveloperExceptionPage(); |
| 37 | + } |
| 38 | + else |
| 39 | + { |
| 40 | + app.UseHsts(); |
| 41 | + } |
47 | 42 |
|
48 | | - app.UseStaticFiles(); |
49 | | - app.UseHttpsRedirection(); |
| 43 | + app.UseStaticFiles(); |
| 44 | + app.UseHttpsRedirection(); |
50 | 45 |
|
51 | | - app.UseRouting(); |
| 46 | + app.UseRouting(); |
52 | 47 |
|
53 | | - app.UseAuthorization(); |
54 | | - app.UseCors(); |
| 48 | + app.UseAuthorization(); |
| 49 | + app.UseCors(); |
55 | 50 |
|
56 | | - app.UseEndpoints(endpoints => |
57 | | - { |
58 | | - endpoints.MapControllers(); |
59 | | - }); |
| 51 | + app.UseEndpoints(endpoints => |
| 52 | + { |
| 53 | + endpoints.MapControllers(); |
| 54 | + }); |
60 | 55 |
|
61 | | - app.UseSwagger(); |
62 | | - app.UseSwaggerUI(c => |
63 | | - { |
64 | | - c.SwaggerEndpoint("/swagger/v1/swagger.json", "Payload Management API V1"); |
65 | | - }); |
66 | | - } |
| 56 | + app.UseSwagger(); |
| 57 | + app.UseSwaggerUI(c => |
| 58 | + { |
| 59 | + c.SwaggerEndpoint("/swagger/v1/swagger.json", "Payload Management API V1"); |
| 60 | + }); |
67 | 61 | } |
68 | 62 | } |
0 commit comments