Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
guardrex committed Jul 5, 2024
1 parent 9b1ca69 commit 172c561
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 82 deletions.
2 changes: 0 additions & 2 deletions aspnetcore/blazor/components/built-in-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ The following built-in Razor components are provided by the Blazor framework. Fo
* [`NavigationLock`](xref:blazor/fundamentals/routing#handleprevent-location-changes)
* [`NavLink`](xref:blazor/fundamentals/routing#navlink-component)
* [`PageTitle`](xref:blazor/components/control-head-content)
* [`Paginator`](xref:blazor/components/quickgrid#paging-items-with-a-paginator-component)
* [`QuickGrid`](xref:blazor/components/quickgrid)
* [`Router`](xref:blazor/fundamentals/routing#route-templates)
* [`RouteView`](xref:blazor/fundamentals/routing#route-templates)
* [`ValidationSummary`](xref:blazor/forms/validation#validation-summary-and-validation-message-components)
Expand Down
80 changes: 3 additions & 77 deletions aspnetcore/blazor/components/quickgrid.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: ASP.NET Core Blazor QuickGrid component
author: guardrex
description: The QuickGrid component is a Razor component for quickly and efficiently displaying data in tabular form.
monikerRange: '>= aspnetcore-7.0'
monikerRange: '>= aspnetcore-8.0'
ms.author: riande
ms.custom: mvc
ms.date: 07/05/2024
Expand All @@ -12,8 +12,6 @@ uid: blazor/components/quickgrid

[!INCLUDE[](~/includes/not-latest-version.md)]

:::moniker range=">= aspnetcore-8.0"

The [`QuickGrid`](xref:Microsoft.AspNetCore.Components.QuickGrid) component is a Razor component for quickly and efficiently displaying data in tabular form. `QuickGrid` provides a simple and convenient data grid component for common grid rendering scenarios and serves as a reference architecture and performance baseline for building data grid components. `QuickGrid` is highly optimized and uses advanced techniques to achieve optimal rendering performance.

## Package
Expand All @@ -30,8 +28,6 @@ For various `QuickGrid` demonstrations, see the [**QuickGrid for Blazor** sample

To implement a `QuickGrid` component:

:::moniker-end

:::moniker range=">= aspnetcore-9.0"

* Specify tags for the `QuickGrid` component in Razor markup (`<QuickGrid>...</QuickGrid>`).
Expand All @@ -57,7 +53,7 @@ To implement a `QuickGrid` component:

:::moniker-end

:::moniker range=">= aspnetcore-8.0 < aspnetcore-9.0"
:::moniker range="< aspnetcore-9.0"

* Specify tags for the `QuickGrid` component in Razor markup (`<QuickGrid>...</QuickGrid>`).
* Name a queryable source of data for the grid. Use ***either*** of the following data sources:
Expand All @@ -81,8 +77,6 @@ To implement a `QuickGrid` component:

:::moniker-end

:::moniker range=">= aspnetcore-8.0"

For example, add the following component to render a grid.

The component assumes that the Interactive Server render mode (`InteractiveServer`) is inherited from a parent component or applied globally to the app, which enables interactive features. For the following example, the only interactive feature is sortable columns.
Expand All @@ -91,52 +85,6 @@ The component assumes that the Interactive Server render mode (`InteractiveServe

:::code language="razor" source="~/../blazor-samples/8.0/BlazorSample_BlazorWebApp/Components/Pages/PromotionGrid.razor":::

:::moniker-end

:::moniker range="< aspnetcore-8.0"

The `QuickGrid` component is an experimental Razor component for quickly and efficiently displaying data in tabular form. `QuickGrid` provides a simple and convenient data grid component for common grid rendering scenarios and serves as a reference architecture and performance baseline for building data grid components. `QuickGrid` is highly optimized and uses advanced techniques to achieve optimal rendering performance.

To get started with `QuickGrid`:

Add a ***prerelease*** package reference for the [`Microsoft.AspNetCore.Components.QuickGrid`](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.QuickGrid) package. If using the .NET CLI to add the package reference, include the `--prerelease` option when you execute the [`dotnet add package` command](/dotnet/core/tools/dotnet-add-package).

[!INCLUDE[](~/includes/package-reference.md)]

> [!NOTE]
> Because the `Microsoft.AspNetCore.Components.QuickGrid` package is an experimental package for .NET 7, the package remains in *prerelease* status forever for .NET 7 Blazor apps. The package reached production status for .NET 8 or later. For more information, see an 8.0 or later version of this article.
Add the following component to render a grid.

`PromotionGrid.razor`:

```razor
@page "/promotion-grid"
@using Microsoft.AspNetCore.Components.QuickGrid
<QuickGrid Items="people">
<PropertyColumn Property="@(p => p.PersonId)" Sortable="true" />
<PropertyColumn Property="@(p => p.Name)" Sortable="true" />
<PropertyColumn Property="@(p => p.PromotionDate)" Format="yyyy-MM-dd" Sortable="true" />
</QuickGrid>
@code {
private record Person(int PersonId, string Name, DateOnly PromotionDate);
private IQueryable<Person> people = new[]
{
new Person(10895, "Jean Martin", new DateOnly(1985, 3, 16)),
new Person(10944, "António Langa", new DateOnly(1991, 12, 1)),
new Person(11203, "Julie Smith", new DateOnly(1958, 10, 10)),
new Person(11205, "Nur Sari", new DateOnly(1922, 4, 27)),
new Person(11898, "Jose Hernandez", new DateOnly(2011, 5, 3)),
new Person(12130, "Kenji Sato", new DateOnly(2004, 1, 9)),
}.AsQueryable();
}
```

:::moniker-end

Access the component in a browser at the relative path `/promotion-grid`.

There aren't current plans to extend `QuickGrid` with features that full-blown commercial grids tend to offer, for example, hierarchical rows, drag-to-reorder columns, or Excel-like range selections. If you require advanced features that you don't wish to develop on your own, continue using third-party grids.
Expand All @@ -145,14 +93,6 @@ There aren't current plans to extend `QuickGrid` with features that full-blown c

The `QuickGrid` component can sort items by columns. Sorting items requires an interactive component render mode.

:::moniker-end

:::moniker range="< aspnetcore-8.0"

The `QuickGrid` component can sort items by columns.

:::moniker-end

Add `Sortable="true"` (<xref:Microsoft.AspNetCore.Components.QuickGrid.ColumnBase%601.Sortable%2A>) to any of the <xref:Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn%602> tags:

```razor
Expand All @@ -163,18 +103,8 @@ In the running app, sort the `QuickGrid` by movie title by selecting the **:::no

## Page items with a `Paginator` component

:::moniker range=">= aspnetcore-8.0"

The `QuickGrid` component can page data from the data source. Paging items requires an interactive component render mode.

:::moniker-end

:::moniker range="< aspnetcore-8.0"

The `QuickGrid` component can page data from the data source.

:::moniker-end

Add a <xref:Microsoft.AspNetCore.Components.QuickGrid.PaginationState> instance to the component's `@code` block. Set the <xref:Microsoft.AspNetCore.Components.QuickGrid.PaginationState.ItemsPerPage%2A> to the number of items to display per page. In the following example, the instance is named `pagination`:

```csharp
Expand Down Expand Up @@ -203,8 +133,6 @@ QuickGrid also supports passing custom attributes and style classes (<xref:Micro
<QuickGrid Items="..." custom-attribute="value" Class="custom-class">
```

:::moniker range=">= aspnetcore-8.0"

## Entity Framework Core (EF Core) data source

EF Core's <xref:Microsoft.EntityFrameworkCore.DbContext> provides a <xref:Microsoft.EntityFrameworkCore.DbSet%601> property for each table in the database. Supply the property to the <xref:Microsoft.AspNetCore.Components.QuickGrid.QuickGrid%601.Items%2A> parameter.
Expand Down Expand Up @@ -241,8 +169,6 @@ Call <xref:Microsoft.Extensions.DependencyInjection.EntityFrameworkAdapterServic
builder.Services.AddQuickGridEntityFrameworkAdapter();
```

:::moniker-end

## Display name support

A column title can be assigned using <xref:Microsoft.AspNetCore.Components.QuickGrid.ColumnBase%601.Title?displayProperty=nameWithType> in the <xref:Microsoft.AspNetCore.Components.QuickGrid.PropertyColumn`2>'s tag. In the following movie example, the column is given the name "`Release Date`" for the column's movie release date data:
Expand Down Expand Up @@ -490,5 +416,5 @@ dotnet aspnet-codegenerator blazor -h
https://github.com/dotnet/AspNetCore.Docs/pull/32747
merges.
For an example use case, see <xref:blazor/tutorials/movie-database-app/index>.
<xref:blazor/tutorials/movie-database-app/index> is a tutorial that demonstrates the use of the `QuickGrid` scaffolder.
-->
40 changes: 37 additions & 3 deletions aspnetcore/fundamentals/tools/dotnet-aspnet-codegenerator.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author: tdykstra
description: The ASP.NET Core code generator tool scaffolds ASP.NET Core projects.
monikerRange: '>= aspnetcore-2.1'
ms.author: tdykstra
ms.date: 06/17/2024
ms.date: 07/05/2024
uid: fundamentals/tools/dotnet-aspnet-codegenerator
---
# ASP.NET Core code generator tool (`aspnet-codegenerator`)
Expand Down Expand Up @@ -57,6 +57,8 @@ The `dotnet aspnet-codegenerator` global command runs the ASP.NET Core code gene

The code generator to run. The available generators are shown in the following table.

:::moniker range=">= aspnetcore-8.0"

Generator | Operation
----------------- | ---
`area` | [Scaffolds an area](xref:mvc/controllers/areas).
Expand All @@ -68,6 +70,21 @@ Generator | Operation
`razorpage` | [Scaffolds Razor Pages](xref:tutorials/razor-pages/model).
`view` | [Scaffolds a view](xref:mvc/views/overview).

:::moniker-end

:::moniker range="< aspnetcore-8.0"

Generator | Operation
----------------- | ---
`area` | [Scaffolds an area](xref:mvc/controllers/areas).
`controller` | [Scaffolds a controller](xref:tutorials/first-mvc-app/adding-model).
`identity` | [Scaffolds Identity](xref:security/authentication/scaffold-identity).
`minimalapi` | Generates an endpoints file (with CRUD API endpoints) given a model and optional database context.
`razorpage` | [Scaffolds Razor Pages](xref:tutorials/razor-pages/model).
`view` | [Scaffolds a view](xref:mvc/views/overview).

:::moniker-end

## Options

`-b|--build-base-path`
Expand Down Expand Up @@ -102,6 +119,8 @@ The target [framework](/dotnet/standard/frameworks) to use.

The following sections detail the options available for the supported generators:

:::moniker range=">= aspnetcore-8.0"

* [Area (`area`)](#area-options)
* [Controller (`controller`)](#controller-options)
* [Blazor (`blazor`)](#blazor-options)
Expand All @@ -111,6 +130,19 @@ The following sections detail the options available for the supported generators
* [Razor page (`razorpage`)](#razor-page-options)
* [View (`view`)](#view-options)

:::moniker-end

:::moniker range="< aspnetcore-8.0"

* [Area (`area`)](#area-options)
* [Controller (`controller`)](#controller-options)
* [Identity (`identity`)](#identity-options)
* [Minimal API (`minimalapi`)](#minimal-api-options)
* [Razor page (`razorpage`)](#razor-page-options)
* [View (`view`)](#view-options)

:::moniker-end

### Area options

Usage: `dotnet aspnet-codegenerator area {AREA NAME}`
Expand All @@ -132,6 +164,8 @@ Use the `-h|--help` option for help:
dotnet aspnet-codegenerator area -h
```

:::moniker range=">= aspnetcore-8.0"

### Blazor options

Razor components can be individually scaffolded for Blazor apps by specifying the name of the template to use. The supported templates are:
Expand Down Expand Up @@ -203,6 +237,8 @@ Use the `-h|--help` option for help:
dotnet aspnet-codegenerator blazor-identity -h
```

:::moniker-end

### Controller options

General options are shown in the following table.
Expand All @@ -220,8 +256,6 @@ Option | Description
`-namespace|--controllerNamespace` | Specify the name of the namespace to use for the generated controller.
`-nv|--noViews` | Generate **no** views.



Use the `-h|--help` option for help:

```dotnetcli
Expand Down

0 comments on commit 172c561

Please sign in to comment.