Currently trying Rider (JetBrains IDE for .Net). I used to work on Visual Studio Enterprise for c# asp.net MVC projects, and i'd like to know if there's a way (on Rider) to do like the "Add -> view -> with create/delete/update/list" feature on Visual Studio?
Something which would generate CRUD views like that :
@model IEnumerable<Web.Models.Warrior>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Health)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Health)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td>
</tr>
}
</table>
PS : if there's a way to do it with controllers to... :D
To add a scaffold, right-click on Controllers folder in the Solution Explorer and select Add → New Scaffolded Item. It will display the Add Scaffold dialog. Select MVC 5 Controller with views, using Entity Framework in the middle pane and click 'Add' button, which will display the Add Controller dialog.
Place the cursoron the return View(); statement and press Alt+Enter to launch Rider's Create Razor views intention.
In the VS Code File menu, select Preferences then Settings. Expand Extensions then find Docs Scaffolding Extension Configuration.
You can use dotnet aspnet-codegenerator
terminal tool. which is used for generating controllers and views with different options.
Install the tool globally.
dotnet tool install --global dotnet-aspnet-codegenerator
dotnet aspnet-codegenerator controller -name MyNewController -m MyModel -dc MyDbContext -outDir Controllers/
You can vote\track this issue: https://youtrack.jetbrains.com/issue/RIDER-12363
This is called Scaffolding and is unfortunately not a feature in Rider. I couldn't tell you if it's a planned feature, but I hope so.
My only suggestion might be to open VS, scaffold, and then use Rider again to continue coding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With