using SoapCore;

namespace MySOAP
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);

            // Add services to the container.

            // ���ӷ�������
            builder.Services.AddSoapCore();
            builder.Services.AddSingleton<ICalculatorService, CalculatorService>();
            builder.Services.AddControllers();

            builder.Services.AddMvc();
            var app = builder.Build();

            // Configure the HTTP request pipeline.
            app.UseRouting();
            app.UseAuthorization();
            _ = app.UseEndpoints(endpoints =>
            {
                endpoints.UseSoapEndpoint<ICalculatorService>("/Service.asmx", new SoapEncoderOptions(), SoapSerializer.XmlSerializer);
            });


            app.MapControllers();

            app.Run();
        }
    }
}
