Skip to content

Polymorphic RequestHandler #33

@michelgrootjans

Description

@michelgrootjans

Is it possible to have a more generic handler that can handle multiple types of requests. For example:

    public class ParentRequest : Request{ }
    public class ChildRequest  : ParentRequest { }

    public class TestRequestHandler : RequestHandler<ParentRequest, TestResponse>
    {
        public override Response Handle(ParentRequest request)
        {
            return new TestResponse();
        }
    }

This TestRequestHandler would then be able to handle a ChildRequest too.

You can view a full test here: https://gist.github.com/michelgrootjans/284aa97119a9daa4ea1a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions