You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting the following error on startup when trying to use Event Handlers: Cannot dynamically create an instance of type. Reason: No parameterless constructor defined.
My project is a brand new project where I copied the DTO, Handler, Request and Endpoint classes as per the documentation just to try it out, as I have a use case in a real project where this seems like it would suit my needs perfectly (need to respond quickly with OK to a request, then fire and forget a task that may take 4-8 seconds). https://fast-endpoints.com/docs/event-bus#_1-define-an-event-model-dto
using System;
namespace FastEndpointsEventHandlerDemo.Features.Order
{
public class OrderCreationHandler : IEventHandler<OrderCreatedEvent>
{
private readonly ILogger _logger;
public OrderCreationHandler(ILogger<OrderCreationHandler> logger)
{
_logger = logger;
}
public Task HandleAsync(OrderCreatedEvent eventModel, CancellationToken ct)
{
_logger.LogInformation($"order created event received:[{eventModel.OrderID}]");
return Task.CompletedTask;
}
}
}
If I add a parameterless constructor as per the error, then I can't use constructor dependency injection.
I'm using the lastest version 5.3.0.1-beta. Was there a change that hasn't been documented yet?
Also, the search box on the documentation isn't working (never produces any results)
The text was updated successfully, but these errors were encountered:
Hi there,
I'm getting the following error on startup when trying to use Event Handlers:
Cannot dynamically create an instance of type. Reason: No parameterless constructor defined.
My project is a brand new project where I copied the DTO, Handler, Request and Endpoint classes as per the documentation just to try it out, as I have a use case in a real project where this seems like it would suit my needs perfectly (need to respond quickly with OK to a request, then fire and forget a task that may take 4-8 seconds). https://fast-endpoints.com/docs/event-bus#_1-define-an-event-model-dto
If I add a parameterless constructor as per the error, then I can't use constructor dependency injection.
I'm using the lastest version
5.3.0.1-beta
. Was there a change that hasn't been documented yet?Also, the search box on the documentation isn't working (never produces any results)
The text was updated successfully, but these errors were encountered: