public static void AddConfiguration(this IServiceCollection service, IConfiguration configuration)
        {
            RepositoriesDI.Register(service);
            ServicesDI.Register(service);
            SwaggerConfiguration.RegisterSwagger(service);
            SerilogConfiguration.CreateLogger();

            service.AddBindConfiguration(configuration);
        }
 public static void Run()
 {
     // Serilog
     SerilogConfiguration.CreateLogger();
     // Configure Autofac
     AutofacWebapiConfig.Initialize(GlobalConfiguration.Configuration);
     // Configure AutoMapper
     AutoMapperConfiguration.Configure();
 }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            var configuration = SerilogConfiguration.GetConfiguration();

            Log.Logger = SerilogConfiguration.CreateLogger(configuration);

            try
            {
                Log.Information("Starting web host");
                CreateHostBuilder(args).Build().Run();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }