MVC Controller with Views, using Entity Framework

raklali 236 Reputation points
2022-10-10T12:32:25.947+00:00

Does Visual Studio Provide a Tool to Custom Design MVC Controller with Views, using Entity Framework template specific to the needs of the project?

This is felt necessary because the <table> generated in Index.cshtml using the default template does not apply the css styling and class="container" does not contain the <table> within the user-screen-width or cause to break-word when the width of the column is wider, and so on. Also, the layout of the data in the other pages of Create, Edit etc are plain forms and does not has facility for in-place/ inline editing.

Developer technologies .NET Entity Framework Core
Developer technologies ASP.NET ASP.NET Core
Developer technologies Visual Studio Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-10-11T02:23:44.987+00:00

    Hi @raklali ,

    Does Visual Studio Provide a Tool to Custom Design template specific to the needs of the project?

    I understand you. But as far as I know, at present Visual Studio doesn't have this kind of tool to custom design the template.

    MVC Controller with Views, using Entity Framework

    This is the Code Generation tool (Microsoft.VisualStudio.Web.CodeGeneration.Design) for ASP.NET Core. Contains the dotnet-aspnet-codegenerator command used for generating controllers and views.

    Since it's a generic-purpose base tool, we can't expect it to do all the customization for us. By using the default templates and styles to generate views, it has already helped us to do much duplicate work, and if you want to add custom styles, you can add the styles to the generated elements (tables, rows, etc.) or cell). And Asp.net core uses bootstrap to add styles by default, you can also use bootstrap to add custom styles. For the in-place/ inline editing function, you can achieve it using JQuery Ajax or use some JQuery data table plugin to do that.

    If you want to the Code Generation tool to provide the above feature, you can submit a new feature request on the Scaffolding forum, hope they can provide this feature in the next version.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    0 comments No comments

  2. raklali 236 Reputation points
    2022-10-11T17:28:05.977+00:00

    Seems We an Alter the Basic Template by Editing the Default Scaffold Templates Files that comes with the VS 2022 or Entitity Framework package. I ain't sure if they are available is older versions of VS.

    Located a Good Link of Microsoft which will help readers and programmers.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.