using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Serilog; using StudentProgressRecord.Forms; using StudentProgressRecord.IRepositories; using StudentProgressRecord.Repositories; using StudentProgressRecord.RepositoryImp; using Unity; using Unity.Lifetime; using Unity.Microsoft.Logging; namespace StudentProgressRecord { internal static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { ApplicationConfiguration.Initialize(); Application.Run(CreateContainer().Resolve()); } private static IUnityContainer CreateContainer() { var container = new UnityContainer(); container.AddExtension(new LoggingExtension(CreateLoggerFactory())); container.RegisterType(new SingletonLifetimeManager()); container.RegisterType (new TransientLifetimeManager()); container.RegisterType (new TransientLifetimeManager()); container.RegisterType (new TransientLifetimeManager()); container.RegisterType (new TransientLifetimeManager()); container.RegisterType (new TransientLifetimeManager()); return container; } private static LoggerFactory CreateLoggerFactory() { var lf = new LoggerFactory(); lf.AddSerilog(new LoggerConfiguration() .ReadFrom.Configuration(new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsetting.json") .Build()) .CreateLogger()); return lf; } } }