dotnet / dotnet/Scaffolding

Copypasta in Edit.cshtml and Create.cshtml

Open
#1,715 2 comments 0 reactions 0 assignees View on GitHub
area-scaffolding customer-reported type-enhancement
Dominant language
C#
Stars
818
Forks
260
Avg merge
1d 8h
Merged PRs (30d)
10

Description

I started with `Create.cshtml` and updated it to my liking. Then I look at `Edit.cshtml` and I can see that I have to apply the same changes again because the code is mostly the same.

I would prefer to have `Edit.cshtml` only, with the extension that you can edit an entity that does not exist yet.

What is the page `Details.cshtml` for? `Edit.cshtml` displays the same information.

Generally speaking, the column with actions is a bad idea. If there is a column that could serve as the human key for a row (even if duplicates are not strictly forbidden), this column should be used to hold links to the form for this particular item. This link would be much easier to understand and to target. This form should contain all actions relevant to the item in question.

Of course, the human key may be composite, which means there should be just one key column containing all the values of the key. This may be hard to do automatically without creating additional attributes for the model (there is currently no attribute corresponding to a "weak key" and adding a Scaffolding-specific one would tie the model to this particular Scaffolding instance — I know we do it any way BUT this is a very bad thing to do).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.