In Structure map I have the following line working with domain events:
public void Dispatch<TEvent>(TEvent eventToDispatch) where TEvent : IDomainEvent
{
foreach (var handler in ObjectFactory.GetAllInstances<IDomainEventHandler<TEvent>>())
{
if (handler.IsActive)
handler.Handle(eventToDispatch);
}
}
I am registering these inside a StructureMap Registry like this:
x.AddAllTypesOf(typeof(IDomainEventHandler<>));
The first block above throws an Unknown error - Structure Map Code 400. Does anyone know how I can get specific types of generic class from the strcuture map container?
TIA
Andrew