43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using NewsBlogAbstractions.WorkAbstractions;
|
|
using NewsBlogDatabaseImplementation.WorkImplementation;
|
|
|
|
namespace NewsBlogView
|
|
{
|
|
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<IArticleWork, ArticleWork>();
|
|
services.AddTransient<IAuthorWork, AuthorWork>();
|
|
services.AddTransient<ICategoryWork, CategoryWork>();
|
|
services.AddTransient<ICommentWork, CommentWork>();
|
|
services.AddTransient<ITagWork, TagWork>();
|
|
|
|
services.AddTransient<FormMain>();
|
|
services.AddTransient<FormArticle>();
|
|
services.AddTransient<FormAuthor>();
|
|
services.AddTransient<FormCategory>();
|
|
services.AddTransient<FormComment>();
|
|
services.AddTransient<FormTag>();
|
|
}
|
|
}
|
|
} |