Open ysmoradi opened 12 months ago
Voting here, with idd Blazor becoming so popular, the strongly typing gets more important. I've tried it myself as well, but we return IActionResult, as we wrap our responses in a HttpOk or NotFound or... This doesn't allow us to link the interface atm
As development with blazor and maui growths, there will be more & more projects with C# in their both backend and frontend. In such a scenario, there could be a shared project that share common code between backend and frontend (for example dto classes).
In refit we use interface with some methods that have attributes such as
Get
,Post
etc. We could put that interface in a shared project, so api controller can implement it and client can call it to achieve a perfect solution that make api calling somehow strongly typed! Like the old days of WCF services (": Example:Sadly, this code is not working because the Get method that returns
IQueryable
has different signature in interface and implementation. This is just an example and there are more scenarios but luckily, most method signatures are compatible. I tried to change get method in interface to such a thing:So I won't have to implement that in api controller at server side and with this approach I can skip a few method signatures that are problematic while enjoying the strongly typed approach for the rest of the method signatures.
But because of this issue and its related PR, so a solution won't work at all.
I can understand that business requirements that @MariusVolkhart has mentioned, but I think we may not skip methods that have refit attributes such as
Get
andPost
at all.I think the first check could be if the method has refit attributes, then we can check if it has body or not so we can achieve this new design I've mentioned without breaking @MariusVolkhart's requirement.
Thanks for your great library ❤️