Giter VIP home page Giter VIP logo

Comments (13)

danroth27 avatar danroth27 commented on July 3, 2024 1

Unfortunately, I don't think we ever formalized our Blazor style guide, but in product code (templates, scaffolding, etc) I think we generally only prefix with @ when required. I wouldn't jump to update the docs to do this just yet though.

from scaffolding.

guardrex avatar guardrex commented on July 3, 2024

In this file ...

public @Model.DbContextTypeName (DbContextOptions<@Model.DbContextTypeName> options)

Shouldn't ...

public @Model.DbContextTypeName (DbContextOptions<@Model.DbContextTypeName> options)

... be ...

public @(Model.DbContextTypeName)(DbContextOptions<@Model.DbContextTypeName> options)

... because I see a stray space in the code ...

public BlazorWebAppMoviesContext (DbContextOptions<BlazorWebAppMoviesContext> options)

from scaffolding.

guardrex avatar guardrex commented on July 3, 2024

More NITs 😈 ...

from scaffolding.

guardrex avatar guardrex commented on July 3, 2024

In the file ...

https://github.com/dotnet/Scaffolding/blob/main/src/Scaffolding/VS.Web.CG.Mvc/Templates/Blazor/Edit.tt

... the model isn't lowercased to match what's done for the other components of the set ...

- @page "/<#= pluralModel #>/edit"
+ @page "/<#= pluralModelLowerInv #>/edit"

Because of it, the path comes out (for example using a movies database example) ...

@page "/Movies/edit"

... instead of the expected ...

@page "/movies/edit"

from scaffolding.

guardrex avatar guardrex commented on July 3, 2024

The following cross-links will need to be removed because TryUpdateModelAsync, which is a focus of the cross-linked content, is Mvc.ControllerBase/RazorPages.PageBase API of MVC/RP and not available for Razor components to use.

WRT documentation coverage: The Blazor Web App tutorial (in progress) will touch on overposting with a short section, and I think we're going to have a special Blazor static SSR form overposting section in our Blazor forms article coverage. If so, I'll open a follow-up issue on this repo to get a new link placed that points to the new coverage.

UPDATE

Opened ...

Add Blazor forms overposting coverage
dotnet/AspNetCore.Docs#32733

... to place Blazor-specific overposting coverage. After coverage goes live, I'll open a new scaffolder repo issue to get the Blazor cross-links into the Blazor bits here and remove the main doc set cross-link. The main doc set coverage will be linked via the Blazor coverage, so devs will still be able to reach it for more info.

from scaffolding.

guardrex avatar guardrex commented on July 3, 2024

Not sure @danroth27 on this one: I thought you said that you were aligning the PU and doc conventions. I see in the scaffolded code ...

<QuickGrid Class="table" Items="DB.Movie">

Cross-ref: https://github.com/dotnet/Scaffolding/blob/main/src/Scaffolding/VS.Web.CG.Mvc/Templates/Blazor/Index.tt#L37

... but I expected ...

<QuickGrid Class="table" Items="@DB.Movie">

... to match the doc convention, which always calls for @ to avoid ambiguity with string literals for component param values.

However, I also recall a convo where it was said that @ would only prefix when required. I probably said at the time that to make the docs adopt that convention that it's a big job. It's been the convention in docs going back to Blazor ancient times 👴 ... worked out with Ryan and/or Pranav IIRC 🤔, and I don't have an open issue or work item on the docs side to change the convention (yet 😄).

from scaffolding.

guardrex avatar guardrex commented on July 3, 2024

There are also extra spaces in the Razor markup files of the CRUD components.

from scaffolding.

guardrex avatar guardrex commented on July 3, 2024

Missing private access modifier from the Edit component's {MODEL NAME}Exists method, which is explicitly stated for doc coverage by convention ...

bool <#= modelName #>Exists(<#= primaryKeyShortTypeName #> <#= primaryKeyNameLowerInv #>)

- bool <#= modelName #>Exists(<#= primaryKeyShortTypeName #> <#= primaryKeyNameLowerInv #>) 
+ private bool <#= modelName #>Exists(<#= primaryKeyShortTypeName #> <#= primaryKeyNameLowerInv #>) 

from scaffolding.

guardrex avatar guardrex commented on July 3, 2024

I'm not sure where this is located (probably over in the main repo actually), but there isn't a return on the last line of the appsettings.json file ...

image

I'll go look now and see if this is in the project template over there. BRB ....................

The serviceDependencies.json file has the same problem ...

image

... and this one ...

image

Those are the only ones. Every other file is fine.

I'm not sure where those are located, here or back on the main repo. I'll leave this comment here in case the PU engineer wants to hunt them down and put in a fix for them.

from scaffolding.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.