I am trying to get a DotNet 6 Entity Framework Core project up and running.
The new version is using something called Swagger, which sounds great because it is supposed to provide a UI to test your web API calls, but I can't get it to work.
So I created my project, got all the models setup via scaffolding. I am now adding my controllers via the Add New Scaffold Item in the controller folder.
I am choosing these options:
I also tried leaving Use a layout page
blank, but that didn't change the outcome.
I rebuilt the project and started it up expecting to see something like this:
But it's not adding my controllers. It just has the default weather one like this:
So I thought maybe I need to add them manually to the main view.
Well I don't think there is a main view, or at least I can't find one. The only shared view created by Visual Studio is called:
_ValidationScriptsPartial.cshtml
Inside that view is just calls to external javascript libraries like this: https://ajax.aspnetcdn.com/ajax/jquery.validate/1.17.0/jquery.validate.min.js
Has anyone been able to get this to work the way it should?
Thanks!
CodePudding user response:
If you want to set api but not view with Scaffold, you should choose API Controller with actions, using Entity Framework
, but not MVC Controllers with views
. And it worked for me.