Skip to content

walkerofthewoods/aspnetcore7

 
 

Repository files navigation

.NET 7 (45)

Samples in this section require .NET 7. You can download it from here.

  • Infer dependency from action parameter

    There is no need for [FromServices] attribute anymore to inject a dependency to your action method.

  • Typed Results - 1

    Microsoft.AspNetCore.Http.TypedResults static class is the “typed” equivalent of the existing Microsoft.AspNetCore.Http.Results class.

  • WithOpenApi - 1

    This sample demonstrate the usage of WithOpenApi extension method available in Microsoft.AspNetCore.OpenApi to customize OpenAPI operation information.

  • Results<> Union Type

    Results<TResult1, TResult2, TResultN> provides better description of the result of the operation that OpenAPI/Swagger can use in describing the API.

  • IFormFile

    This sample demonstrates the usage of IFormFile to upload a file in Minimal API.

  • IFormFileCollection

    This sample demonstrates the usage of IFormFileCollection to upload multiple files in Minimal API.

Endpoint Filter

  • Endpoint Filter - 1

    This sample shows how to apply an Endpoint filter to your minimal API.

  • Endpoint Filter - 2

    This sample shows how to apply multiple Endpoint filters to your minimal APIs.

  • Endpoint Filter - 3

    This examples shows the sequence of code execution before RouteHandlerFilterDelegate and after RouteHandlerFilterDelegate in multiple endpoint filters.

  • Endpoint Filter - 4

    Use IStatusCodeHttpResult to detect return result in filter.

Route Group

  • Route Group - 1

    MapGroup() extension methods allow grouping of endpoints with a common prefix. It also allow group metadata to be attached to the group.

  • Route Group - 2

    Use .WithTags(), .WithDescription(), .WithSummary() to enrich OpenAPI information for all the endpoints in the group.

  • Route Group - 3

    Use .ExcludeFromDescription to exclude endpoints from OpenAPI description.

Authentication

  • Authentication - JWT

    This sample shows the usage of the simplified authentication and authorization via builder.AddAuthentication().AddJwtBearer();.

  • Authentication - Cookie

    This sample shows the usage of the simplified authentication and authorization via builder.AddAuthentication().AddCookie();.

  • Authentication - Mixed

    This sample shows how to use both JWT and Cookie authentications in the same application.

Output cache

  • Output Cache - 1

    This sample shows how to use the OutputCache middleware using basic options.

  • Output Cache - 2

    This sample shows how to use the OutputCache middleware and vary them by one or more query string.

  • Output Cache - 3

    This sample shows how to tagged cache items and evict them by tag using IOutputCacheStore.EvictByTagAsync.

  • Output Cache - 4 This sample shows how to enable output cache for every single endpoint.

  • Output Cache - 5 This sample shows how to setup a global Output Cache policy to cache any request with "cache" query string parameter.

  • Output Cache - 6 This sample demonstrates on how to setup a global Output Cache policy to cache any request that start with "/cache" in the url segments.

  • Output Cache - 7 This sample demonstrates on how to setup a cache policy and use it. Specific policy override the global base policy.

  • Output Cache - 8 This sample demonstrates on how to setup a cache policy that set an expiration time of 10 minutes.

gRPC

  • gRPC - 13

    This sample shows how to make a GET HTTP call to a gRPC endpoint via gRPC JSON transcoding.

  • gRPC - 14

    This sample shows how to make a POST HTTP call to a gRPC endpoint via gRPC JSON transcoding.

  • gRPC - 15

    This sample shows how to make a POST HTTP call to a gRPC endpoint via gRPC JSON transcoding by combining route parameter and body.

  • gRPC - 16

    This sample shows how to make a PUT HTTP call to a gRPC endpoint via gRPC JSON transcoding.

  • gRPC - 17

    This sample shows how to make a PATCH HTTP call to a gRPC endpoint via gRPC JSON transcoding.

Blazor

  • Component - 18

    This sample demonstrates @bind:after modifier that allows to execute async code after a binding event has been completed (value has changed).

  • Component - 19

    This sample demonstrates @bind:get @bind:set modifier that simplify two-way data binding.

  • Component - 20

    This sample shows how to implement a HTML custom element using Blazor Web Assembly.

  • Component - 21

    This sample shows how set and get a property of a HTML custom element implemented using Blazor Web Assembly.

  • Component - 22

    This sample shows how to raise an event from HTML custom element implemented using Blazor Web Assembly.

Problem Details

System.Text.Json

  • JSON - 23

    Show how to customize serialization using DefaultJsonTypeInfoResolver.

  • JSON - 24

    Customize serialization by writing number as string in JSON for Age values.

  • JSON - 25

    In this case we add one extra timestamp property to the serialization process.

Orleans 7

  • Orleans - 1

    This sample shows how to use Orleans 7 in a minimal API application. It shows the new way on how to configure an Orleans server.

  • Orleans - 2

    This is a sample project that shows how to use Redis as a persistence provider for Orleans.

  • Orleans - 3

    This sample demonstrates the functionality of Orleans' Timer via Grain.RegisterTimer. It's useful to trigger actions to be repeated frequently (less than every minute).

  • Orleans - 4

    This sample demonstrates the functionality of Orleans' Reminder via Grain.RegisterOrUpdateReminder. It's useful to trigger actions to be repeated infrequently (more than every minute, hours or days). This is a persistent timer that survives grain restarts. Reminder is much expensive than Timer.

  • Orleans - 5

    This sample demonstrates using HttpClient in a grain and also introduces the concept of a Stateless Worker grain.

About

OpenAPI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%