
using System.Text;
using Autofac.Extensions.DependencyInjection;
using Autofac;
using WmsMobileServe.AppRunning;
using WmsMobileServe.Utils;

Console.Title = "WMS��̨����";
Console.OutputEncoding = Encoding.UTF8;
ConsoleLog.DisbleQuickEditMode();

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers().AddJsonOptions(options =>
{
    options.JsonSerializerOptions.PropertyNamingPolicy = null; // �޸ķ������ã�����ԭʵ��������
});
builder.Services.AddHostedService<HostService>();
// ��ӿ��������κ��˷���
builder.Services.AddCors(options =>
{
    options.AddPolicy("any", policyBuilder =>
    {
        policyBuilder.WithOrigins("*").AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
    });
});
builder.WebHost.UseUrls("http://*:19990");
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()); // ʹ�� autoFac �滻ע������
builder.Host.ConfigureContainer<ContainerBuilder>(builder =>
{
    builder.RegisterModule<AutofacModule>();
});

var app = builder.Build();
app.UseCors("any");
app.UseAuthorization();
app.MapControllers();
app.Run();
