2024-05-21 22:53:01 +04:00
|
|
|
using BookshopBusinessLogic.BusinessLogics;
|
|
|
|
using BookshopContracts.BusinessLogicsContracts;
|
|
|
|
using BookshopContracts.StorageContracts;
|
|
|
|
using BookshopDatabaseImplement.Implemets;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using NLog.Extensions.Logging;
|
|
|
|
using System;
|
|
|
|
|
2024-05-14 17:42:58 +04:00
|
|
|
namespace BookshopView
|
|
|
|
{
|
|
|
|
internal static class Program
|
|
|
|
{
|
2024-05-21 22:53:01 +04:00
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
2024-05-14 17:42:58 +04:00
|
|
|
/// <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-05-21 22:53:01 +04:00
|
|
|
var services = new ServiceCollection();
|
|
|
|
ConfigureServices(services);
|
|
|
|
_serviceProvider = services.BuildServiceProvider();
|
2024-05-21 23:58:37 +04:00
|
|
|
Application.Run(_serviceProvider.GetRequiredService<FormBookCreate>());
|
2024-05-21 22:53:01 +04:00
|
|
|
}
|
|
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddLogging(option =>
|
|
|
|
{
|
|
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
|
|
option.AddNLog("nlog.config");
|
|
|
|
});
|
|
|
|
services.AddTransient<IAuthorStorage, AuthorStorage>();
|
|
|
|
services.AddTransient<IGenreStorage, GenreStorage>();
|
|
|
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
2024-05-21 23:58:37 +04:00
|
|
|
services.AddTransient<IUserStorage, UserStorage>();
|
|
|
|
services.AddTransient<IPublisherStorage, PublisherStorage>();
|
2024-05-21 22:53:01 +04:00
|
|
|
|
|
|
|
services.AddTransient<IAuthorLogic, AuthorLogic>();
|
2024-05-21 23:58:37 +04:00
|
|
|
services.AddTransient<IBookLogic, BookLogic>();
|
2024-05-21 22:53:01 +04:00
|
|
|
services.AddTransient<IGenreLogic, GenreLogic>();
|
|
|
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
2024-05-21 23:58:37 +04:00
|
|
|
services.AddTransient<IUserLogic, UserLogic>();
|
|
|
|
services.AddTransient<IPublisherLogic, PublisherLogic>();
|
2024-05-21 22:53:01 +04:00
|
|
|
|
|
|
|
services.AddTransient<FormMain>();
|
|
|
|
services.AddTransient<FormCreateOrder>();
|
|
|
|
services.AddTransient<FormGenre>();
|
|
|
|
services.AddTransient<FormGenres>();
|
|
|
|
services.AddTransient<FormAuthor>();
|
|
|
|
services.AddTransient<FormAuthors>();
|
2024-05-21 23:58:37 +04:00
|
|
|
services.AddTransient<FormUser>();
|
|
|
|
services.AddTransient<FormUsers>();
|
|
|
|
services.AddTransient<FormPublisher>();
|
|
|
|
services.AddTransient<FormPublishers>();
|
|
|
|
services.AddTransient<FormBookCreate>();
|
2024-05-14 17:42:58 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|