2024-10-30 01:08:12 +04:00
|
|
|
|
using BusinessLogics.BusinessLogics;
|
|
|
|
|
using Contracts.BusinessLogicsContracts;
|
|
|
|
|
using Contracts.StorageContracts;
|
|
|
|
|
using DatabaseImplement.Implements;
|
|
|
|
|
using Forms;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NLog.Extensions.Logging;
|
2024-10-16 00:18:25 +04:00
|
|
|
|
|
2024-10-30 01:08:12 +04:00
|
|
|
|
namespace WinForms
|
2024-09-19 00:39:30 +04:00
|
|
|
|
{
|
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
2024-10-30 01:08:12 +04:00
|
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
|
|
|
|
2024-09-19 00:39:30 +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-10-30 01:08:12 +04:00
|
|
|
|
var services = new ServiceCollection();
|
|
|
|
|
ConfigureServices(services);
|
|
|
|
|
_serviceProvider = services.BuildServiceProvider();
|
|
|
|
|
|
|
|
|
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="services"></param>
|
|
|
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
services.AddLogging(option =>
|
|
|
|
|
{
|
|
|
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
|
|
|
option.AddNLog("nlog.config");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
services.AddTransient<IBookStorage, BookStorage>();
|
|
|
|
|
services.AddTransient<IAuthorStorage, AuthorStorage>();
|
|
|
|
|
|
|
|
|
|
// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
services.AddTransient<IBookLogic, BookLogic>();
|
|
|
|
|
services.AddTransient<IAuthorLogic, AuthorLogic>();
|
|
|
|
|
|
|
|
|
|
// IoC-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
services.AddTransient<FormMain>();
|
2024-10-31 22:43:05 +04:00
|
|
|
|
services.AddTransient<FormBook>();
|
|
|
|
|
services.AddTransient<FormAuthor>();
|
2024-09-19 00:39:30 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|