Skip to content

Commit fe4b676

Browse files
Merge pull request #34811 from dotnet/main
Merge to Live
2 parents 1acd5c9 + c478c6d commit fe4b676

File tree

2 files changed

+110
-16
lines changed

2 files changed

+110
-16
lines changed

aspnetcore/blazor/tutorials/movie-database-app/part-2.md

Lines changed: 109 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,27 @@ Paste all of the following commands at the prompt (`>`) of the **Terminal**. Whe
119119

120120
When you paste multiple commands, all of the commands execute except the last one. The last command doesn't execute until you press <kbd>Enter</kbd> on the keyboard.
121121

122+
:::moniker range=">= aspnetcore-10.0"
123+
124+
```dotnetcli
125+
dotnet tool install --global dotnet-aspnet-codegenerator
126+
dotnet tool install --global dotnet-ef
127+
dotnet add package Microsoft.EntityFrameworkCore.SQLite
128+
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
129+
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
130+
dotnet add package Microsoft.EntityFrameworkCore.Tools
131+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
132+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
133+
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
134+
```
135+
136+
> [!IMPORTANT]
137+
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
138+
139+
:::moniker-end
140+
141+
:::moniker range=">= aspnetcore-9.0 < aspnetcore-10.0"
142+
122143
```dotnetcli
123144
dotnet tool install --global dotnet-aspnet-codegenerator
124145
dotnet tool install --global dotnet-ef
@@ -135,19 +156,42 @@ dotnet add package Microsoft.EntityFrameworkCore.Design
135156
> [!IMPORTANT]
136157
> After the first nine commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
137158
138-
> [!NOTE]
139-
> The preceding commands are .NET CLI commands, and .NET CLI commands are executed when entered at a [PowerShell](/powershell/) prompt, which is the default command shell of the VS Code **Terminal**.
140-
141-
Open the app's project file (`BlazorWebAppMovies.csproj`). Drop the `<IncludeAssets>` and `<PrivateAssets>` from the `Microsoft.EntityFrameworkCore.Design` package reference. In the following example, the `{VERSION}` placeholder is the package's version and remains unchanged:
159+
Open the app's project file (`BlazorWebAppMovies.csproj`). Mark the `Microsoft.EntityFrameworkCore.Design` assembly reference as publishable by adding `<Publish>true</Publish>` to the package reference. In the following example, the `{VERSION}` placeholder is the package's version and remains unchanged:
142160

143161
```diff
144-
- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
145-
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
146-
- <PrivateAssets>all</PrivateAssets>
147-
- </PackageReference>
148-
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}" />
162+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
163+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
164+
<PrivateAssets>all</PrivateAssets>
165+
+ <Publish>true</Publish>
166+
</PackageReference>
167+
```
168+
169+
The preceding update to the package reference is a workaround for a breaking change in .NET 9 EF Core tooling. The change to the package reference can be reverted in apps that are eventually updated to .NET 10 or later. For more information, see [Breaking changes in EF Core 9 (EF9)](/ef/core/what-is-new/ef-core-9.0/breaking-changes#microsoftentityframeworkcoredesign-not-found-when-using-ef-tools).
170+
171+
:::moniker-end
172+
173+
:::moniker range="< aspnetcore-9.0"
174+
175+
```dotnetcli
176+
dotnet tool install --global dotnet-aspnet-codegenerator
177+
dotnet tool install --global dotnet-ef
178+
dotnet add package Microsoft.EntityFrameworkCore.SQLite
179+
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
180+
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
181+
dotnet add package Microsoft.EntityFrameworkCore.Tools
182+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
183+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
184+
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
149185
```
150186

187+
> [!IMPORTANT]
188+
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
189+
190+
:::moniker-end
191+
192+
> [!NOTE]
193+
> The preceding commands are .NET CLI commands, and .NET CLI commands are executed when entered at a [PowerShell](/powershell/) prompt, which is the default command shell of the VS Code **Terminal**.
194+
151195
Save the project file.
152196

153197
The preceding commands add:
@@ -175,6 +219,27 @@ Paste all of the following commands at the prompt (`>`) of the command shell. W
175219

176220
When you paste multiple commands, all of the commands execute except the last one. The last command doesn't execute until you press <kbd>Enter</kbd> on the keyboard.
177221

222+
:::moniker range=">= aspnetcore-10.0"
223+
224+
```dotnetcli
225+
dotnet tool install --global dotnet-aspnet-codegenerator
226+
dotnet tool install --global dotnet-ef
227+
dotnet add package Microsoft.EntityFrameworkCore.SQLite
228+
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
229+
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
230+
dotnet add package Microsoft.EntityFrameworkCore.Tools
231+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
232+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
233+
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
234+
```
235+
236+
> [!IMPORTANT]
237+
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
238+
239+
:::moniker-end
240+
241+
:::moniker range=">= aspnetcore-9.0 < aspnetcore-10.0"
242+
178243
```dotnetcli
179244
dotnet tool install --global dotnet-aspnet-codegenerator
180245
dotnet tool install --global dotnet-ef
@@ -191,16 +256,39 @@ dotnet add package Microsoft.EntityFrameworkCore.Design
191256
> [!IMPORTANT]
192257
> After the first nine commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
193258
194-
Open the app's project file (`BlazorWebAppMovies.csproj`). Drop the `<IncludeAssets>` and `<PrivateAssets>` from the `Microsoft.EntityFrameworkCore.Design` package reference. In the following example, the `{VERSION}` placeholder is the package's version and remains unchanged:
259+
Open the app's project file (`BlazorWebAppMovies.csproj`). Mark the `Microsoft.EntityFrameworkCore.Design` assembly reference as publishable by adding `<Publish>true</Publish>` to the package reference. In the following example, the `{VERSION}` placeholder is the package's version and remains unchanged:
195260

196261
```diff
197-
- <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
198-
- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
199-
- <PrivateAssets>all</PrivateAssets>
200-
- </PackageReference>
201-
+ <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}" />
262+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="{VERSION}">
263+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
264+
<PrivateAssets>all</PrivateAssets>
265+
+ <Publish>true</Publish>
266+
</PackageReference>
202267
```
203268

269+
The preceding update to the package reference is a workaround for a breaking change in .NET 9 EF Core tooling. The change to the package reference can be reverted in apps that are eventually updated to .NET 10 or later. For more information, see [Breaking changes in EF Core 9 (EF9)](/ef/core/what-is-new/ef-core-9.0/breaking-changes#microsoftentityframeworkcoredesign-not-found-when-using-ef-tools).
270+
271+
:::moniker-end
272+
273+
:::moniker range="< aspnetcore-9.0"
274+
275+
```dotnetcli
276+
dotnet tool install --global dotnet-aspnet-codegenerator
277+
dotnet tool install --global dotnet-ef
278+
dotnet add package Microsoft.EntityFrameworkCore.SQLite
279+
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
280+
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
281+
dotnet add package Microsoft.EntityFrameworkCore.Tools
282+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid
283+
dotnet add package Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter
284+
dotnet add package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore
285+
```
286+
287+
> [!IMPORTANT]
288+
> After the first eight commands execute, make sure that you press <kbd>Enter</kbd> on the keyboard to execute the last command.
289+
290+
:::moniker-end
291+
204292
Save the project file.
205293

206294
The preceding commands add:
@@ -313,6 +401,12 @@ The scaffolding process creates the following component files and movie database
313401

314402
The component files in the `MoviePages` folder are described in greater detail in the next part of this tutorial. The database context is described later in this article.
315403

404+
:::zone pivot="vs"
405+
406+
If the `MoviePages` folder and assets aren't present after scaffolding, return to the [Scaffold the model](#scaffold-the-model) section and rescaffold the `Movie` model, making sure that you select the **Razor Components using Entity Framework (CRUD)** scaffolder under **Installed** > **Common** > **Blazor** > **Razor Component** in the **Add New Scaffold Item** dialog.
407+
408+
:::zone-end
409+
316410
ASP.NET Core is built with dependency injection, which is a software design pattern for achieving [Inversion of Control (IoC)](/dotnet/standard/modern-web-apps-azure-architecture/architectural-principles#dependency-inversion) between classes and their dependencies. Services, such as the EF Core database context, are registered with dependency injection during application startup. These services are injected into Razor components for use by the components.
317411

318412
The [`QuickGrid` component](xref:Microsoft.AspNetCore.Components.QuickGrid) is a Razor component for efficiently displaying data in tabular form. The scaffolder places a `QuickGrid` component in the `Index` component (`Components/Pages/Index.razor`) to display movie entities. Calling <xref:Microsoft.Extensions.DependencyInjection.EntityFrameworkAdapterServiceCollectionExtensions.AddQuickGridEntityFrameworkAdapter%2A> on the service collection adds an EF Core adapter for QuickGrid to recognize EF Core-supplied <xref:System.Linq.IQueryable%601> instances and to resolve database queries asynchronously for efficiency.

aspnetcore/fundamentals/static-files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The default web app templates call the <xref:Microsoft.AspNetCore.Builder.Static
6262

6363
[!code-csharp[](~/fundamentals/static-files/samples/9.x/StaticFilesSample/Program.cs?name=snippet&highlight=15)]
6464

65-
The parameterless `UseStaticFiles` method overload marks the files in [web root](xref:fundamentals/index#web-root) as servable. The following markup references `wwwroot/images/MyImage.jpg`:
65+
The parameterless `MapStaticAssets` method overload marks the files in [web root](xref:fundamentals/index#web-root) as servable. The following markup references `wwwroot/images/MyImage.jpg`:
6666

6767
```html
6868
<img src="~/images/MyImage.jpg" class="img" alt="My image" />

0 commit comments

Comments
 (0)