2024-11-12 23:13:20 +04:00
|
|
|
|
using ProjectLibrary.Repositories.Implementations;
|
|
|
|
|
using ProjectLibrary.Repositories;
|
|
|
|
|
using Unity;
|
2024-11-20 19:31:06 +04:00
|
|
|
|
using ProjectLibrary.Repositores;
|
2024-12-08 13:24:07 +04:00
|
|
|
|
using ProjectLibrary.Repositores.Implementations;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Serilog;
|
|
|
|
|
using Unity.Microsoft.Logging;
|
2024-11-12 23:13:20 +04:00
|
|
|
|
|
2024-11-08 14:21:36 +04:00
|
|
|
|
namespace ProjectLibrary
|
|
|
|
|
{
|
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The main entry point for the application.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
|
|
|
|
// To customize application configuration such as set high DPI settings or default font,
|
|
|
|
|
// see https://aka.ms/applicationconfiguration.
|
|
|
|
|
ApplicationConfiguration.Initialize();
|
2024-11-12 23:13:20 +04:00
|
|
|
|
Application.Run(CreateContainer().Resolve<FormLibrary>());
|
2024-11-08 14:21:36 +04:00
|
|
|
|
}
|
2024-11-12 23:13:20 +04:00
|
|
|
|
|
|
|
|
|
private static IUnityContainer CreateContainer()
|
|
|
|
|
{
|
|
|
|
|
var container = new UnityContainer();
|
|
|
|
|
|
2024-12-08 13:24:07 +04:00
|
|
|
|
container.AddExtension(new LoggingExtension(CreateLoggerFactory()));
|
|
|
|
|
|
2024-11-12 23:13:20 +04:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
container.RegisterType<IBookRepository, BookRepository>();
|
|
|
|
|
container.RegisterType<ILibraryRepository, LibraryRepository>();
|
|
|
|
|
container.RegisterType<IReaderRepository, ReaderRepository>();
|
|
|
|
|
container.RegisterType<IOrderRepository, OrderRepository>();
|
|
|
|
|
container.RegisterType<ITicketExtensionsRepository, TicketExtensionsRepository>();
|
2024-12-08 13:24:07 +04:00
|
|
|
|
container.RegisterType<IConnectionString, ConnectionString>();
|
2024-11-12 23:13:20 +04:00
|
|
|
|
return container;
|
|
|
|
|
}
|
2024-12-08 13:24:07 +04:00
|
|
|
|
|
|
|
|
|
private static LoggerFactory CreateLoggerFactory()
|
|
|
|
|
{
|
|
|
|
|
var loggerFactory = new LoggerFactory();
|
|
|
|
|
loggerFactory.AddSerilog(new LoggerConfiguration()
|
|
|
|
|
.ReadFrom.Configuration(new ConfigurationBuilder()
|
|
|
|
|
.SetBasePath(Directory.GetCurrentDirectory())
|
|
|
|
|
.AddJsonFile("appsettings.json")
|
|
|
|
|
.Build())
|
|
|
|
|
.CreateLogger());
|
|
|
|
|
return loggerFactory;
|
|
|
|
|
}
|
2024-11-08 14:21:36 +04:00
|
|
|
|
}
|
|
|
|
|
}
|