Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aspnetcore/blazor/advanced-scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,5 @@ This is a trivial example. In more realistic cases with complex and deeply neste
* The necessary information doesn't exist to permit the framework to generate sequence numbers automatically at runtime unless the information is captured at compile time.
* Don't write long blocks of manually-implemented <xref:Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder> logic. Prefer `.razor` files and allow the compiler to deal with the sequence numbers. If you're unable to avoid manual <xref:Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder> logic, split long blocks of code into smaller pieces wrapped in <xref:Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.OpenRegion%2A>/<xref:Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.CloseRegion%2A> calls. Each region has its own separate space of sequence numbers, so you can restart from zero (or any other arbitrary number) inside each region.
* If sequence numbers are hardcoded, the diff algorithm only requires that sequence numbers increase in value. The initial value and gaps are irrelevant. One legitimate option is to use the code line number as the sequence number, or start from zero and increase by ones or hundreds (or any preferred interval).
* For loops, the sequence numbers should increase in your source code, not in terms of runtime behavior. The fact that, at runtime, the numbers repeat is how the diffing system realises you're in a loop.
* For loops, the sequence numbers should increase in your source code, not in terms of runtime behavior. The fact that, at runtime, the numbers repeat is how the diffing system realizes you're in a loop.
* Blazor uses sequence numbers, while other tree-diffing UI frameworks don't use them. Diffing is far faster when sequence numbers are used, and Blazor has the advantage of a compile step that deals with sequence numbers automatically for developers authoring `.razor` files.
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/choose-aspnet-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The following table compares ASP.NET Core to ASP.NET 4.x.
|Higher performance than ASP.NET 4.x|Good performance|
|[Use .NET Core runtime](/dotnet/standard/choosing-core-framework-server)|Use .NET Framework runtime|

See [ASP.NET Core targeting .NET Framework](xref:index#target-framework) for information on ASP.NET Core 2.x support on .NET Framework.
See [ASP.NET Core targeting .NET Framework](xref:index#aspnet-core-target-frameworks) for information on ASP.NET Core 2.x support on .NET Framework.

## ASP.NET Core scenarios

Expand Down
52 changes: 52 additions & 0 deletions aspnetcore/fundamentals/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,58 @@ This article provides an overview of the fundamentals for building ASP.NET Core

For Blazor fundamentals guidance, which adds to or supersedes the guidance in this article, see <xref:blazor/fundamentals/index>.

## How to download a sample

Many of the articles and tutorials include links to sample code.

1. [Download the ASP.NET repository zip file](https://codeload.github.com/dotnet/AspNetCore.Docs/zip/main).
1. Unzip the `AspNetCore.Docs-main.zip` file.
1. To access an article's sample app in the unzipped repository, use the URL in the article's sample link to help you navigate to the sample's folder. Usually, an article's sample link appears at the top of the article with the link text *View or download sample code*.

### Preprocessor directives in sample code

To demonstrate multiple scenarios, sample apps use the `#define` and `#if-#else/#elif-#endif` preprocessor directives to selectively compile and run different sections of sample code. For those samples that make use of this approach, set the `#define` directive at the top of the C# files to define the symbol associated with the scenario that you want to run. Some samples require defining the symbol at the top of multiple files in order to run a scenario.

For example, the following `#define` symbol list indicates that four scenarios are available (one scenario per symbol). The current sample configuration runs the `TemplateCode` scenario:

```csharp
#define TemplateCode // or LogFromMain or ExpandDefault or FilterInCode
```

To change the sample to run the `ExpandDefault` scenario, define the `ExpandDefault` symbol and leave the remaining symbols commented-out:

```csharp
#define ExpandDefault // TemplateCode or LogFromMain or FilterInCode
```

For more information on using [C# preprocessor directives](/dotnet/csharp/language-reference/preprocessor-directives/) to selectively compile sections of code, see [#define (C# Reference)](/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-define) and [#if (C# Reference)](/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-if).

### Regions in sample code

Some sample apps contain sections of code surrounded by [#region](/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-region) and [#endregion](/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-endregion) C# directives. The documentation build system injects these regions into the rendered documentation topics.

Region names usually contain the word "snippet." The following example shows a region named `snippet_WebHostDefaults`:

```csharp
#region snippet_WebHostDefaults
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
#endregion
```

The preceding C# code snippet is referenced in the topic's markdown file with the following line:

```md
[!code-csharp[](sample/SampleApp/Program.cs?name=snippet_WebHostDefaults)]
```

You may safely ignore or remove the `#region` and `#endregion` directives that surround the code. Don't alter the code within these directives if you plan to run the sample scenarios described in the topic.

For more information, see [Contribute to the ASP.NET documentation: Code snippets](https://github.com/dotnet/AspNetCore.Docs/blob/main/CONTRIBUTING.md#code-snippets).

## Program.cs

ASP.NET Core apps created with the web templates contain the application startup code in the `Program.cs` file. The `Program.cs` file is where:
Expand Down
3 changes: 1 addition & 2 deletions aspnetcore/fundamentals/minimal-apis/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ uid: fundamentals/minimal-apis/overview

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

Minimal APIs are a simplified approach for building fast HTTP APIs with ASP.NET Core.
You can build fully functioning REST endpoints with minimal code and configuration. Skip traditional scaffolding and avoid unnecessary controllers by fluently declaring API routes and actions. For example, the following code creates an API at the root of the web app that returns the text, `"Hello World!"`.
Minimal APIs are a simplified approach for building fast HTTP APIs with ASP.NET Core. You can build fully functioning REST endpoints with minimal code and configuration. Skip traditional scaffolding and avoid unnecessary controllers by fluently declaring API routes and actions. For example, the following code creates an API at the root of a web app that returns a greeting:

```csharp
var app = WebApplication.Create(args);
Expand Down
76 changes: 70 additions & 6 deletions aspnetcore/includes/benefits.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,85 @@
ASP.NET Core provides the following benefits:

* A unified story for building web UI and web APIs.
:::moniker range=">= aspnetcore-6.0"

<!-- AUTHOR NOTE: >=6.0 content showcases Blazor and
Minimal APIs, demotes RP/MVC -->

* A unified story for building web apps, web APIs, Azure IoT (Internet of Things) apps, and mobile backends.
* Architected for testability.
* [Blazor](xref:blazor/index) lets you create rich interactive client-side UIs using [.NET](/dotnet/standard/tour) and [C#](/dotnet/csharp/) with wide browser support based on HTML/JavaScript, including mobile browsers. You can also build hybrid desktop and mobile apps with .NET and Blazor.
* [Minimal APIs](xref:fundamentals/minimal-apis) are a simplified approach for building fast web APIs with minimal code and configuration by fluently declaring API routes and actions.
* Supports [Razor Pages](xref:razor-pages/index) and [Model-View-Controller (MVC)](xref:mvc/overview) app development.
* Ability to develop and run on Windows, macOS, and Linux.
* Open-source and [community-focused](https://live.asp.net/).
* Integrate seamlessly with popular client-side frameworks and libraries, including [Angular](/visualstudio/javascript/tutorial-asp-net-core-with-angular), [React](/visualstudio/javascript/tutorial-asp-net-core-with-react), [Vue](/visualstudio/javascript/tutorial-asp-net-core-with-vue), and [Bootstrap](https://getbootstrap.com/).
* Support for hosting Remote Procedure Call (RPC) services using [gRPC](xref:grpc/index).
* A cloud-ready, environment-based [configuration system](xref:fundamentals/configuration/index).
* Built-in [dependency injection](xref:fundamentals/dependency-injection).
* A lightweight, [high-performance](https://github.com/aspnet/benchmarks), and modular HTTP request pipeline.
* Ability to host in the cloud or on-premises with the following:
* [Kestrel](xref:fundamentals/servers/kestrel)
* [Azure App Service](https://azure.microsoft.com/products/app-service)
* [IIS](xref:host-and-deploy/iis/index)
* [HTTP.sys](xref:fundamentals/servers/httpsys)
* [Nginx](xref:host-and-deploy/linux-nginx)
* [Docker](xref:host-and-deploy/docker/index)
* [Side-by-side versioning](/dotnet/standard/choosing-core-framework-server#choose-net).
* Tooling that simplifies modern web development.

:::moniker-end

:::moniker range=">= aspnetcore-3.0 < aspnetcore-6.0"

<!-- AUTHOR NOTE: >=3.0 <6.0 content showcases Blazor,
demotes RP/MVC, doesn't mention
Minimal APIs -->

* A unified story for building web apps, web APIs, Azure IoT (Internet of Things) apps, and mobile backends.
* Architected for testability.
* [Blazor](xref:blazor/index) lets you use C# in the browser alongside JavaScript. Share server-side and client-side app logic all written with .NET.
* [Razor Pages](xref:razor-pages/index) makes coding page-focused scenarios easier and more productive.
* [Blazor](xref:blazor/index) lets you create rich interactive client-side UIs using [.NET](/dotnet/standard/tour)/[C#](/dotnet/csharp/) with wide browser support based on HTML/JavaScript, including mobile browsers. You can also build hybrid desktop and mobile apps with .NET and Blazor.
* Supports [Razor Pages](xref:razor-pages/index) and [Model-View-Controller (MVC)](xref:mvc/overview) app development.
* Ability to develop and run on Windows, macOS, and Linux.
* Open-source and [community-focused](https://live.asp.net/).
* Integration of [modern, client-side frameworks](xref:blazor/index) and development workflows.
* Integrate seamlessly with popular client-side frameworks and libraries, including [Angular](/visualstudio/javascript/tutorial-asp-net-core-with-angular), [React](/visualstudio/javascript/tutorial-asp-net-core-with-react), [Vue](/visualstudio/javascript/tutorial-asp-net-core-with-vue), and [Bootstrap](https://getbootstrap.com/).
* Support for hosting Remote Procedure Call (RPC) services using [gRPC](xref:grpc/index).
* A cloud-ready, environment-based [configuration system](xref:fundamentals/configuration/index).
* Built-in [dependency injection](xref:fundamentals/dependency-injection).
* A lightweight, [high-performance](https://github.com/aspnet/benchmarks), and modular HTTP request pipeline.
* Ability to host on the following:
* Ability to host in the cloud or on-premises with the following:
* [Kestrel](xref:fundamentals/servers/kestrel)
* [Azure App Service](https://azure.microsoft.com/products/app-service)
* [IIS](xref:host-and-deploy/iis/index)
* [HTTP.sys](xref:fundamentals/servers/httpsys)
* [Nginx](xref:host-and-deploy/linux-nginx)
* [Docker](xref:host-and-deploy/docker/index)
* [Side-by-side versioning](/dotnet/standard/choosing-core-framework-server#side-by-side-net-versions-per-application-level).
* [Side-by-side versioning](/dotnet/standard/choosing-core-framework-server#choose-net).
* Tooling that simplifies modern web development.

:::moniker-end

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

<!-- AUTHOR NOTE: >=3.0 <6.0 content focuses on RP/MVC, no Blazor, no Minimal APIs -->

* A unified story for building web apps, web APIs, Azure IoT (Internet of Things) apps, and mobile backends.
* Architected for testability.
* Develop apps and APIs using [Razor Pages](xref:razor-pages/index) and [Model-View-Controller (MVC)](xref:mvc/overview) frameworks.
* Ability to develop and run on Windows, macOS, and Linux.
* Open-source and [community-focused](https://live.asp.net/).
* Integrate seamlessly with popular client-side frameworks and libraries, including [Angular](/visualstudio/javascript/tutorial-asp-net-core-with-angular), [React](/visualstudio/javascript/tutorial-asp-net-core-with-react), [Vue](/visualstudio/javascript/tutorial-asp-net-core-with-vue), and [Bootstrap](https://getbootstrap.com/).
* Support for hosting Remote Procedure Call (RPC) services using [gRPC](xref:grpc/index).
* A cloud-ready, environment-based [configuration system](xref:fundamentals/configuration/index).
* Built-in [dependency injection](xref:fundamentals/dependency-injection).
* A lightweight, [high-performance](https://github.com/aspnet/benchmarks), and modular HTTP request pipeline.
* Ability to host in the cloud or on-premises with the following:
* [Kestrel](xref:fundamentals/servers/kestrel)
* [Azure App Service](https://azure.microsoft.com/products/app-service)
* [IIS](xref:host-and-deploy/iis/index)
* [HTTP.sys](xref:fundamentals/servers/httpsys)
* [Nginx](xref:host-and-deploy/linux-nginx)
* [Docker](xref:host-and-deploy/docker/index)
* [Side-by-side versioning](/dotnet/standard/choosing-core-framework-server#choose-net).
* Tooling that simplifies modern web development.

:::moniker-end
2 changes: 1 addition & 1 deletion aspnetcore/includes/bind-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
> [BindProperty(SupportsGet = true)]
> ```
>
> For more information, see [ASP.NET Core Community Standup: Bind on GET discussion (YouTube)](https://www.youtube.com/watch?v=p7iHB9V-KVU&feature=youtu.be&t=54m27s).
> For more information, see [ASP.NET Community Standup: Bind on GET discussion (YouTube)](https://www.youtube.com/watch?v=p7iHB9V-KVU&feature=youtu.be&t=54m27s).
Loading