diff --git a/src/FilterLists.Agent/CaptureLists.cs b/src/FilterLists.Agent/CaptureLists.cs new file mode 100644 index 000000000..1180d0755 --- /dev/null +++ b/src/FilterLists.Agent/CaptureLists.cs @@ -0,0 +1,18 @@ +using System.Threading; +using System.Threading.Tasks; +using MediatR; + +namespace FilterLists.Agent +{ + public class CaptureLists + { + public class Command : IRequest + { + } + + public class Handler : AsyncRequestHandler + { + protected override Task Handle(Command request, CancellationToken cancellationToken) => Task.CompletedTask; + } + } +} \ No newline at end of file diff --git a/src/FilterLists.Agent/FilterLists.Agent.csproj b/src/FilterLists.Agent/FilterLists.Agent.csproj index 6b5dfe30e..7baeabda3 100644 --- a/src/FilterLists.Agent/FilterLists.Agent.csproj +++ b/src/FilterLists.Agent/FilterLists.Agent.csproj @@ -30,6 +30,8 @@ + + diff --git a/src/FilterLists.Agent/Program.cs b/src/FilterLists.Agent/Program.cs index 72d486580..a1faf122a 100644 --- a/src/FilterLists.Agent/Program.cs +++ b/src/FilterLists.Agent/Program.cs @@ -1,6 +1,8 @@ using System; +using System.Threading.Tasks; using Autofac; using Autofac.Extensions.DependencyInjection; +using MediatR; using Microsoft.Extensions.DependencyInjection; namespace FilterLists.Agent @@ -15,12 +17,13 @@ public static class Program private static IServiceProvider _serviceProvider; - public static void Main() + public static async Task Main() { RegisterServices(); - //var service = _serviceProvider.GetService(); - //service.DoSomething(); + var mediator = _serviceProvider.GetService(); + + await mediator.Send(new CaptureLists.Command()); DisposeServices(); } @@ -28,8 +31,9 @@ public static void Main() private static void RegisterServices() { var containerBuilder = new ContainerBuilder(); - //builder.RegisterType().As(); - containerBuilder.Populate(new ServiceCollection()); + var serviceCollection = new ServiceCollection(); + serviceCollection.AddMediatR(typeof(Program).Assembly); + containerBuilder.Populate(serviceCollection); var container = containerBuilder.Build(); _serviceProvider = new AutofacServiceProvider(container); }