1 Star 0 Fork 0

Ax0ne/practical-aspnetcore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Samples for ASP.NET Core 5.0 (325)

The goal of this project is to enable .NET programmers to learn the new ASP.NET Core stack from the ground up directly from code. There is so much power in the underlying ASP.NET Core stack. Don't miss them!

I highly recommend using Visual Studio Code to play around with these samples but it is not required. You can use Visual Studio 2019 as well.

Previous versions

3.1 LTS, 2.1 LTS

.NET 6 Preview 1 Section (1)

You can access .NET 6 Preview 1 specific samples here.

Sections

Section
Blazor Client Side (Web Assembly) (Components, Data Binding) (20) Mini Apps (1)
Blazor Server Side (Localization) (15) MVC (Localization, Routing, Razor Class Library, Tag Helpers, View Component, etc) (46)
Caching (5) Orchard Core (4)
Configurations (7) Path String (HttpContext.Request.Path) (1)
CoreWCF (1) Razor Pages (9)
Dependency Injection (4) Request (Form, Cookies, Query String, Headers) (14)
Diagnostics (6) Response (4)
Endpoint Routing (32) Single File Application (1)
Features (10) Static Files and File Provider (9)
Generic Hosting (9) System.Text.Json (11)
gRPC (including grpc-Web) (12) Startup (12)
Health Check (6) Syndications (3)
IHttpClientFactory (4) URL Redirect/Rewrite (6)
IHostedService (2) Uri Helper (5)
Logging (3) Web Sockets (5)
Localization and Globalization (6) Web Utilities (3)
Middleware (14) Orleans (12)

For Data Access samples, go to the excellent ORM Cookbook.

How to run these samples

To run these samples, simply open your command line console, go to each folder and execute dotnet watch run.

Foundation ASP.NET Core 5 Samples

Basic (6)

  • Hello World

    This is the simplest ASP.NET Core application you can create. An ASP.NET Core application includes a super fast web server called Kestrel. In a few lines of code we set up the web server and a simple app.

    In this sample we use a Startup class to configure your application. This is the canonical way of doing thing.

  • Hello World - 2

    This is the equivalent of the previous Hello World sample except that in this case we don't use a Startup class. This way of configuring things is not common.

  • Hello World - 3

    This sample uses C# 9 top level statements.

  • IWebHostConfiguration

    This sample demonstrates the usage of IWebHostEnvironment from Configure method.

  • IHostEnvironment

    This sample shows how to access IHostEnvironment from ConfigureServices.

  • IConfiguration

    This sample demonstrates the usage of IConfiguration from `Configure' method.

Misc (8)

  • Application Environment

    This sample shows how to obtain application environment information (target framework, etc).

  • Show Connection info

    Enumerate the connection information of a HTTP request.

  • Keeping track of anonymous users

    Keep track of anonymous user in your ASP.NET Core (useful in scenario such as keeping track of shopping cart) using ReturnTrue.AspNetCore.Identity.Anonymous library.

  • Password Hasher server

    Give it a string and it will generate a secure hash for you, e.g. localhost:5000?password=mypassword.

  • Integrate Newtonsoft.Json back

    ASP.NET Core has a new built in JSON Serializer/Deserializer. This sample shows how to integrate Newtonsoft.Json back to your project.

  • Version info

    Show various version info of the framework your system is running on.

  • IApplicationLifetime

    Responds to application startup and shutdown.

    We are using IApplicationLifetime that trigger events during application startup and shutdown.

  • CommandLine

    This project shows a simple integration between System.CommandLine, a command line parsing library with ASP.NET Core app.

Server-Sent Events (1)

  • Forever Server

    This server will send a 'hello world' greeting forever.

Markdown (2)

Utils (3)

  • Status Codes

    Here we contrast between the usage of Microsoft.AspNetCore.Http.StatusCodes and System.Net.HttpStatusCode.

  • MediaTypeNames

    This class provides convenient constants for some common MIME types. It's not extensive by any means however MediaTypeNames.Text.Html and MediaTypeNames.Application.Json come handy.

  • MediaTypeNames - 2

    Using FileExtensionContentTypeProvider to obtain the correct MIME type of a filename extension.

Device Detection (1)

The samples in this section rely on Wangkanai.Detection library.

  • Device Detection

    This is the most basic device detection. You will be able to detect whether the client is a desktop or a mobile client.

Image Sharp (1)

All these samples require SixLabors.ImageSharp.Web middleware package. This middleware is an excelent tool to process your day to day image processing need.

  • Image-Sharp

    This example shows how to enable image resizing functionality to your site. It's super easy and the middleware takes care of caching, etc.

Misc

The MIT License (MIT) Copyright (c) 2016 Dody Gunawinata Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

practical-aspnetcore 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Ax0ne/practical-aspnetcore.git
git@gitee.com:Ax0ne/practical-aspnetcore.git
Ax0ne
practical-aspnetcore
practical-aspnetcore
net5.0

搜索帮助