using IMCS.CCS.Services; using Microsoft.EntityFrameworkCore; using Quartz.Impl; using Quartz; using StackExchange.Redis; using System.ComponentModel.Design; using WCS.Common; using WCS.Common.Redis; using WCS.Config; using WCS.Repository; using WCS.Service; using WCS.Service.Impl; using WCS.Service.Jobs; using WCS.Services; var builder = WebApplication.CreateBuilder(args); // Add services to the container. // ���� Redis ���� var redisConfiguration = builder.Configuration.GetConnectionString("Redis"); builder.Services.AddSingleton(ConnectionMultiplexer.Connect(redisConfiguration)); var connectionString = builder.Configuration.GetConnectionString("MySqlConnection"); builder.Services.AddDbContext(options => options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString))); builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); // ע�� Repository builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); // ע�� Service builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); /*builder.Services.AddAutoMapper(typeof(AutoMapperConfig)); //�ļ����ݷ��� builder.Services.AddTransient(); //��Ŀ���� builder.Services.AddTransient(); //������� builder.Services.AddTransient(); //��ʱ���� ���� builder.Services.AddTransient(); //ע��ISchedulerFactory��ʵ���� builder.Services.AddTransient(); //web api ������� builder.Services.AddTransient(); //Job ʵ�������� builder.Services.AddSingleton(); //Reultful ��� api ���� ���� builder.Services.AddTransient(); //������־ builder.Services.AddSingleton(); //��Ŀ������Ϣ builder.Services.AddSingleton();*/ //redis ע�� //RepositoryRedisModule.RegisterRedisRepository(services, Configuration["RedisConnectionString"]); //services.AddScoped(); //builder.Services.AddTransient(); //builder.Services.AddTransient(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); builder.Services.AddScoped(); //builder.Services.AddScoped(); builder.Services.AddScoped(); //builder.Services.AddScoped(); //builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); //builder.Services.AddScoped(); builder.Services.AddScoped(); //builder.Services.AddScoped(); builder.Services.AddScoped(); //builder.Services.AddScoped(); builder.Services.AddScoped(); var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Your API V1")); } // ���þ�̬�ļ��м�� app.UseStaticFiles(); // ����Ĭ���ļ��м�� app.UseDefaultFiles(); // ����·�� app.UseRouting(); // ���������ض��� HTML ҳ�� app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapGet("/", context => { context.Response.Redirect("/client/index.html"); return Task.CompletedTask; }); }); app.Run();