6

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

mason
  • 31,774
  • 10
  • 77
  • 121
j0w
  • 505
  • 2
  • 12
  • 32
  • Related question: https://stackoverflow.com/questions/46062951/scaffolding-controller-in-rider – brad Apr 25 '18 at 19:20

3 Answers3

12

But you still can...

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/

Community
  • 1
  • 1
bereket gebredingle
  • 12,064
  • 3
  • 36
  • 47
5

You can vote\track this issue: https://youtrack.jetbrains.com/issue/RIDER-12363

xtmq
  • 3,380
  • 22
  • 26
1

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.

brad
  • 1,407
  • 19
  • 33
  • Well, thanks for the "scaffolding" word I didn't knew. Your solution may be one solution (not sure if it's the optimal solution but .. meh, why not xD) or i'll wait till JetBrains implements it in Rider... – j0w Apr 25 '18 at 20:53
  • You're welcome! Yeah I hope they implement it too :) – brad Apr 25 '18 at 21:08