55 lines
2.3 KiB
C#
55 lines
2.3 KiB
C#
using ForumBusinessLogic;
|
|
using ForumContracts.BusinessLogicContracts;
|
|
using ForumContracts.StoragesContracts;
|
|
using BlogDatabase.Implements;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using System;
|
|
|
|
namespace Forum
|
|
{
|
|
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)
|
|
{
|
|
services.AddTransient<ICategoryStorage, CategoryStorage>();
|
|
services.AddTransient<IMessageStorage, MessageStorage>();
|
|
services.AddTransient<IRoleStorage, RoleStorage>();
|
|
services.AddTransient<ITopicStorage, TopicStorage>();
|
|
services.AddTransient<IUserStorage, UserStorage>();
|
|
|
|
services.AddTransient<ICategoryLogic, CategoryLogic>();
|
|
services.AddTransient<IMessageLogic, MessageLogic>();
|
|
services.AddTransient<IRoleLogic, RoleLogic>();
|
|
services.AddTransient<ITopicLogic, TopicLogic>();
|
|
services.AddTransient<IUserLogic, UserLogic>();
|
|
|
|
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>();
|
|
}
|
|
}
|
|
} |