using System.Threading.Tasks;
public static void Main()
c.Register<IAsyncNotificationHandler<Notification>, SomeNotificationHandler>();
c.Register<DbContext, Model1>(reuse: Reuse.InResolutionScopeOf(typeof(IAsyncNotificationHandler<Notification>)));
var f = c.ResolveMany<object>(typeof(IAsyncNotificationHandler<Notification>)).First();
public interface IActionHandler
DbContext DbContext { get; }
public class Model1 : DbContext {}
public class RequestCommand : IAsyncRequest<string>
public class Notification : IAsyncNotification
public class SomeRequestHandler : IAsyncRequestHandler<RequestCommand, string>
public DbContext DbContext { get; private set; }
public IMediator Mediator { get; private set; }
public SomeRequestHandler(DbContext dbContext, IMediator mediator)
public Task<string> Handle(RequestCommand message)
Console.WriteLine("request called");
Mediator.PublishAsync(new Notification()).Wait();
return Task.FromResult("ret");
public class SomeNotificationHandler : IAsyncNotificationHandler<Notification>
public DbContext DbContext { get; private set; }
public SomeNotificationHandler(DbContext dbContext)
public Task Handle(Notification notification)
Console.WriteLine("notification called");
return Task.FromResult(0);