You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							60 lines
						
					
					
						
							2.1 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							60 lines
						
					
					
						
							2.1 KiB
						
					
					
				| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.IdentityModel.Tokens; | |
| using Microsoft.OpenApi.Models; | |
| using System.Text.Json.Serialization; | |
| using System.Text; | |
| using Cloud_Manager.Models.Interfaces; | |
| using Cloud_Manager; | |
| using Cloud_Manager.Services; | |
| using Cloud_Manager.Models.ServiceRepo; | |
| using Cloud_Manager.Models.Enums; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.Extensions.Options; | |
| using Cloud_Manager.Middleware; | |
| 
 | |
| var builder = WebApplication.CreateBuilder(args); | |
| 
 | |
| // Add services to the container. | |
| builder.Services.AddSignalR(); | |
| builder.Services.AddControllers().AddJsonOptions(x => x.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles); | |
| builder.Logging.ClearProviders(); | |
| builder.Logging.AddConsole(); | |
| builder.Services.AddEntityFrameworkMySql().AddDbContext<BiskilogContext>(options => | |
| { | |
|     options.UseMySql(builder.Configuration.GetConnectionString("Connection"), new MariaDbServerVersion(new Version())); | |
| }); | |
| builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); | |
| builder.Services.AddDbContext<BiskAcdbContext>(); | |
| builder.Services.AddScoped<ICompanyInfo, CompanyService>(); | |
| builder.Services.AddScoped<IAuthService, AuthenticationService>(); | |
| builder.Services.AddScoped<IKeyService, TokenService>(); | |
| builder.Services.AddScoped<IConnectionService, ConnectionService>(); | |
| builder.Services.AddScoped<IProduct, ProductRepo>(); | |
| builder.Services.AddScoped<ISalesInterface, SalesService>(); | |
| builder.Services.AddScoped<IUser, UserService>(); | |
| builder.Services.AddScoped<ICustomer, CustomerService>(); | |
| 
 | |
| // Add services to the container. | |
| builder.Services.AddControllers(); | |
| // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle | |
| builder.Services.AddEndpointsApiExplorer(); | |
| builder.Services.AddSwaggerGen(); | |
| 
 | |
| 
 | |
| var app = builder.Build(); | |
| // Configure the HTTP request pipeline. | |
| if (app.Environment.IsDevelopment()) | |
| { | |
|     app.UseSwagger(); | |
|     app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "SecureSwagger v1")); | |
| }else | |
| { | |
|     app.UseHttpsRedirection(); | |
| } | |
| app.UseKeyValidation(); | |
| 
 | |
| app.UseAuthentication(); | |
| 
 | |
| app.MapControllers(); | |
| 
 | |
| app.Run(); |