Skip to content
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

Allow configuration of generation return time #153

Open
taori opened this issue Jul 29, 2024 · 4 comments
Open

Allow configuration of generation return time #153

taori opened this issue Jul 29, 2024 · 4 comments

Comments

@taori
Copy link

taori commented Jul 29, 2024

ValueTask should only be used when the duration of a task in the majority of cases will be below 20ms. Not sure in which article i read this exactly (Stephen Cleary, i think), but in the majority of cases where networks are involved this is probably not the case. ValueTask returns force me to do async+await if i am interacting with a task, to get around ValueTask. But when you use async+await a state machine is returned which also isn't really ideal. Having control over ValueTask vs Task would be good.

@martinothamar
Copy link
Owner

I think that would be difficult given the interfaces aren't generated (the ones contained in Mediator.Abstractions)

@taori
Copy link
Author

taori commented Aug 5, 2024

When talking about abstractions you are talking about for example the return type of the send method for example, yes?

@martinothamar
Copy link
Owner

Yes, defined on the interface

@taori
Copy link
Author

taori commented Aug 5, 2024

Hm, yeah, but in places where you interact with Send or similar methods it being a ValueTask would not be an issue. If it just changed for the RequestHandler interface it would be good enough. Because then you can just do

return HttpClient.GetStringAsync("somerequest"); if the returntype is string, instead of having to do async+await everywhere, just so it compiles (when you don't want to generate the statemachine but just directly return the task instead).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants