| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using Database.Database;
- using Kitty_Fall.Woker.Services;
- using log4net;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Hosting;
- using System.Reflection;
- using System.Xml;
- Environment.SetEnvironmentVariable("ORA_SDTZ", "UTC");
- XmlDocument log4netConfig = new XmlDocument();
- log4netConfig.Load(File.OpenRead("log4net.config"));
- var repo = log4net.LogManager.CreateRepository(
- Assembly.GetEntryAssembly(),
- typeof(log4net.Repository.Hierarchy.Hierarchy)
- );
- log4net.Config.XmlConfigurator.Configure(repo, log4netConfig["log4net"]);
- var builder = WebApplication.CreateBuilder(args);
- var oracleSessionTimeZone = builder.Configuration["OracleSessionTimeZone"];
- if (!string.IsNullOrWhiteSpace(oracleSessionTimeZone))
- {
- Environment.SetEnvironmentVariable("ORA_SDTZ", oracleSessionTimeZone);
- }
- // Add services to the container.
- builder.Services.AddDbContext<ModelContext>(options =>
- options.UseOracle(builder.Configuration["Connection"]));
- builder.Services.AddHostedService<GameRewardPayoutWorker>();
- builder.Services.AddHostedService<GameMonthlyWinnerWorker>();
- var app = builder.Build();
- app.Run();
|