I have a .net core winform application and am implementing n-tier architecture(ApplicationLayer(winform), BLL, DAL)
Installed MediatR and MediatR.Extensions.Microsoft.DependencyInjection
I am currently following this site:
https://dotnetcoretutorials.com/2019/04/30/the-mediator-pattern-part-3-mediatr-library/
Where do I put this code
public void ConfigureServices(IServiceCollection services)
{
services.AddMediatR(Assembly.GetExecutingAssembly());
//Other injected services.
}
I have tried putting it on Main() like so:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(IServiceCollection services)
{
services.AddMediatR(Assembly.GetExecutingAssembly());
services.AddTransient<IApplicationHandler, ApplicationHandler>();
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
and its giving me this error
Program does not contain a static 'Main' method suitable for an entry point
