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

Request: Add Support for PageModels, Web Api Controllers and SignalR Hubs #3

Closed
TorreyGarland opened this issue Mar 24, 2021 · 8 comments

Comments

@TorreyGarland
Copy link

Great tool. A vast improvement over R4MVC.

I would like to make a request... add support for page models, web apis and signalR hubs.

@sleeuwen
Copy link
Owner

Hi @TorreyGarland,

I'm interested in your suggestion as I've also thought about how I could integrate it with razor pages. So I'm curious how you would see such an integration work?

For web APIs, in asp.net core APIs use the same controller discovery as for mvc so I think that should already work. If it doesn't work for you I'd like to know what you're trying to do as that would be a bug (note: .net framework asp.net web APIs are not supported and I don't plan to add support for it)

Lastly, I'm not sure what you're asking for with the signalr hubs, can you elaborate on this?

@TorreyGarland
Copy link
Author

I am or have worked on several MVC projects, both .NET Framework and Core.

One of my biggest pet peeves is hard-coded URLs that are either misspelled or not changed automatically upon refactoring. I have magic strings in general.

We were using T4MVC (works great) and R4MVC, but R4MVC is lacking in a few needed features, in particular PageModel url generation.

Working on a .NET 5 MVC project right now. I would really like to see something similar to what you have, but also provides support for PageModels and WebApis. Maybe SignalR is a bit of a stretch.

As far as the path that I would suggest...check to see if a INamedTypeSymbol basetype ends with "PageModel".

@thepigeonfighter
Copy link

Hello, I just started a personal project to do exactly what this set out to do. I too would like to add support for Page Models and Blazor components. I was just reading up on this last night. It sounds like the @page in both PageModels and Blazor components should be the thing to filter on as they essentially create a RouteAttribute on the page model classes. Are you looking for contributions to this code base or would you prefer to keep this a solo project?

@thepigeonfighter
Copy link

Ah I see that this feature is under development. Look forward to checking it out.

@sleeuwen
Copy link
Owner

Hi @thepigeonfighter
I've been working on the support for razor pages in the branch feature/razor-pages. As part of that work I also released a preview version of the library at v0.4.0-alpha.1 to nuget. I just wanted to test it out on some larger projects than the small sample project I created in the repo before releasing the full version. But if you're interested you can already try out the alpha version as it should already work.

For the blazor components, I don't know too much about it yet but it definitely sounds interesting. If you have any ideas on that I'd love to know but might be better to track that in a different issue. If you want to take a stab at it yourself that's also cool (but it's probably better to wait before 0.4.0 is released as from what you said you can probably reuse some of the code for that).

@thepigeonfighter
Copy link

Ok great, I've been looking through the code looks pretty good, the API is a little different than the way I had imagined but seems promising. I'll try out the alpha and if I have any issues I'll let you know. Thanks for all the hard work.

@sleeuwen
Copy link
Owner

@TorreyGarland I've just published version 0.4.0 to NuGet which adds support for Razor Pages (via @Url.Pages()). There might still be some rough edges with it but @thepigeonfighter did a great job testing the alpha versions already. Please try it out and let me know if you have any issues with it.

I think this should cover most of this issue, as far as I can tell Web API should also work fine as long as you have a IUrlHelper.

@TorreyGarland
Copy link
Author

Just tested. Works like a champ. Thanks for the upgrade.

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

3 participants