-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The PipelineBehavior is failing because of a List property in IRequest? #317
Comments
Looks like the problem is something else, I have a problem registering multiple classes for IPipelineBehavior using ASP.NET DI. I will do a search on google to find out more. |
I resolved by passing in the Classes like this. Is there a better way to handle this? If not, I will close this issue.
|
What did your original registration look like?
…On Tue, Oct 2, 2018 at 10:37 PM coderabsolute ***@***.***> wrote:
I resolved by passing in the Classes like this. Is there a better way to
handle this? If not, I will close this issue.
services.AddScoped(typeof(IPipelineBehavior<CustomerAddRequest, CommandResponse>), typeof(CustomerAddBehavior<CustomerAddRequest, CommandResponse>));
services.AddScoped(typeof(IPipelineBehavior<BrandDeleteRequest, CommandResponse>), typeof(BrandDeleteBehavior<BrandDeleteRequest, CommandResponse>));
services.AddScoped(typeof(IPipelineBehavior<CustomerDeleteRequest, CommandResponse>), typeof(CustomerDeleteBehavior<CustomerDeleteRequest, CommandResponse>));
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#317 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGYMnSKblrdJ96HOmdYDOOWtjauAsXZks5uhDDwgaJpZM4XD60U>
.
|
These my original registrations which didn't resolve by itself. Maybe, am missing out something?
|
Ah. You can't do generic type constraints with vanilla MS.Extensions.DI. See my PR to fix this: |
If you want generic constraints, you have to pull in an 3rd-party container. |
Am getting the following error when I use the
PipelineBehavior
only when aList
is used as a property. Not sure whether the IPipelineBehavior is not handling theList
or something am doing incorrectly? When I remove the List property then the code gets executed. Maybe, am doing something wrong, can someone please help me. Thanks in advance!Here is the actual code am executing.
The
Addresses
property in theAddressAddRequest
class is causing the issue. If I remove this property all works well. Any guess please? :)public IEnumerable<AddressAddRequest> Addresses { get; set; }
This is how am registering with the ServiceCollection.
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(CustomerAddPipelineBehavior<,>));
The text was updated successfully, but these errors were encountered: