How to intercept and modify AutoQuery request?

I need to intercept a call to AutoQuery in order to map a request DTO value to a different value in the underlying DTO.

My Request DTO

[Route("/users", "GET")]
public class FindUsers : QueryDb<User>
    public string UserName { get; set; }

User has a NormalizedUserName property (which I don’t want to expose to the end user) which is an UPPER CASE version of UserName.

While calling FindUsers with UserName = someone, I want it to use NormalizedUserName = SOMEONE during the actual call.

Is there any “clean” way of doing this?

Yes create a Custom AutoQuery implementation then modify the Request DTO in the state you want it in before you call AutoQuery APIs to execute the query.

1 Like

Worked like a charm. Thanks!

1 Like