PIbd-22-Ismailov_SUBD/BlogDataModels/BlogViewModel/Program.cs

55 lines
2.3 KiB
C#
Raw Normal View History

2023-09-06 21:16:28 +04:00
using ForumBusinessLogic;
using ForumContracts.BusinessLogicContracts;
using ForumContracts.StoragesContracts;
using BlogDatabase.Implements;
2023-05-18 21:34:36 +04:00
using Microsoft.Extensions.DependencyInjection;
2023-09-06 21:16:28 +04:00
using System;
2023-05-18 21:34:36 +04:00
2023-09-06 21:16:28 +04:00
namespace Forum
2023-05-18 21:34:36 +04:00
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
/// <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();
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
2023-09-06 21:16:28 +04:00
services.AddTransient<ICategoryStorage, CategoryStorage>();
services.AddTransient<IMessageStorage, MessageStorage>();
services.AddTransient<IRoleStorage, RoleStorage>();
services.AddTransient<ITopicStorage, TopicStorage>();
2023-05-18 21:34:36 +04:00
services.AddTransient<IUserStorage, UserStorage>();
2023-09-06 21:16:28 +04:00
services.AddTransient<ICategoryLogic, CategoryLogic>();
services.AddTransient<IMessageLogic, MessageLogic>();
services.AddTransient<IRoleLogic, RoleLogic>();
services.AddTransient<ITopicLogic, TopicLogic>();
2023-05-18 21:34:36 +04:00
services.AddTransient<IUserLogic, UserLogic>();
2023-09-06 21:16:28 +04:00
services.AddTransient<FormMain>();
services.AddTransient<FormRoles>();
services.AddTransient<FormRole>();
services.AddTransient<FormUsers>();
services.AddTransient<FormUser>();
services.AddTransient<FormCategories>();
services.AddTransient<FormCategory>();
services.AddTransient<FormAddTopics>();
services.AddTransient<FormAddTopic>();
services.AddTransient<FormCreateMessage>();
services.AddTransient<FormTests>();
2023-05-18 21:34:36 +04:00
}
}
}