Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
161a6da
Create README.md
Camefor Jul 26, 2020
b0551bc
Startup/Program文件配置
Camefor Jul 26, 2020
e05e7ca
添加学习算法
Camefor Jul 30, 2020
65e2d3f
提交
Camefor Nov 12, 2020
ec048a5
爬取图片
Camefor Nov 12, 2020
49139dc
Camefor Dec 23, 2020
092116c
添加
Camefor Jan 5, 2021
169b81e
hh
Camefor Jan 6, 2021
761ed5e
3
Camefor Jan 25, 2021
ac76383
update README
Camefor Apr 28, 2021
611c44a
Camefor Jul 1, 2021
fdb861b
提交测试
Camefor Jul 2, 2021
f67dadd
update
Camefor Jul 5, 2021
5d5e797
增加 学习 EasyNetQ
Camefor Jan 21, 2022
de51a94
add new test application
Camefor Jan 21, 2022
2362f20
Update README.md
Camefor Feb 9, 2022
7a35022
测试 EasyNetQ 的 Send/Receive 模式
Camefor Feb 9, 2022
7bf89c5
测试 消息路由(Topic Based Routing
Camefor Feb 9, 2022
a008159
删除无用
Camefor Feb 17, 2022
e02bce2
Camefor Feb 17, 2022
0b9b549
删除无用项目
Camefor Feb 17, 2022
65722ad
Merge branch 'master' of https://github.com/Camefor/ASP.NETCoreRoadMap
Camefor Feb 21, 2022
0ee77b9
整理代码 删除无用代码
Camefor Mar 24, 2022
2b2894b
Camefor Mar 24, 2022
f67fb58
keep learning~
Camefor Mar 24, 2022
257b08a
Update README.md
Camefor Mar 24, 2022
4dbbb4d
Update README.md
Camefor Mar 24, 2022
c857847
Update README.md
Camefor Mar 24, 2022
45046c9
Update README.md
Camefor Mar 24, 2022
4697a4f
添加学习ASP.NET Core 中的筛选器代码
Camefor Mar 24, 2022
fc0dcd7
删除无用文件
Camefor Mar 30, 2022
bfd2bbd
控制器级别筛选器
Camefor Mar 30, 2022
1f4002b
取消和设置短路
Camefor Mar 30, 2022
75a4c77
又,,,ASP.NET Core Fundamentals 基础教程
Camefor Mar 30, 2022
159cf57
Update README.md
Camefor Apr 2, 2022
9d9a212
Update README.md
Camefor Apr 2, 2022
e360951
add ThirdpartyLib\jose-jwt
Camefor Apr 13, 2022
5113ce8
Merge branch 'master' of https://github.com/Camefor/ASP.NETCoreRoadMap
Camefor Apr 13, 2022
1465757
add DotNetty
Camefor Apr 13, 2022
b18f23a
Update Test DotNetty
Camefor Apr 22, 2022
c40d7c1
Camefor May 6, 2022
7d5d9fb
update
Camefor May 9, 2022
db9f508
add LeetCodeSort
Camefor May 9, 2022
372d04a
Camefor May 9, 2022
f9dbb44
add MergeSort
Camefor May 10, 2022
a68e724
update
Camefor May 23, 2022
a1e4395
Add DLM Projects
Camefor Jun 1, 2022
57a7e57
update DLM
Camefor Jun 2, 2022
6330d72
Complete DLM
Camefor Jun 2, 2022
3c971a8
Add Learn AspNetCoreRateLimit
Camefor Jun 7, 2022
706105e
添加 设计模式 学习模块:(发布-订阅)模式
Camefor Jun 9, 2022
1ebde50
update DesignPatterns
Camefor Jun 9, 2022
253c1c3
update
Camefor Jun 9, 2022
79daa0d
update
Camefor Jun 10, 2022
5edfe5b
事件总线完结
Camefor Jun 10, 2022
fa1f910
update
Camefor Jun 21, 2022
22a19e7
update
Camefor Jun 23, 2022
fdc8598
Update README.md
Camefor Jun 23, 2022
3ed9a46
Update README.md
Camefor Jun 23, 2022
d5a90ab
add aspnet-core-identity project
Camefor Jun 29, 2022
e250717
Update Program.cs
Camefor Jun 30, 2022
965b8ba
complete MongoDB for Identity database,
Camefor Jun 30, 2022
a2e1ce4
update Learn IdentityServer
Camefor Jun 30, 2022
b5f715b
update ISExample Project
Camefor Jul 1, 2022
4851c18
update
Camefor Jul 1, 2022
6d71cd8
done
Camefor Jul 4, 2022
5cbff8d
add AsynAndParallel
Camefor Jul 19, 2022
63dac9e
add learn grpc
Camefor Jul 28, 2022
9e43022
add learn grpc
Camefor Jul 28, 2022
c240cee
update
Camefor Jul 28, 2022
7a999ff
update services
Camefor Jul 29, 2022
2ac885a
update
Camefor Sep 22, 2022
693cc7b
add new project
Camefor Sep 23, 2022
2f86a5c
update
Camefor Sep 30, 2022
af1e17b
删除无用项目
Camefor Oct 12, 2022
ed50526
😊
Camefor Oct 12, 2022
eec694d
update
Camefor Nov 21, 2022
6089682
add polly
Camefor Nov 28, 2022
c5369a9
polly polly
Camefor Nov 29, 2022
5e1b56b
Camefor Nov 29, 2022
25d32be
learn LambdaAndLINQ
Camefor May 18, 2023
fd0b496
Camefor May 18, 2023
1b410bd
update
Camefor May 18, 2023
3d4dfcc
Expression And Func
May 19, 2023
076e7d7
Bump Grpc.Net.Client
dependabot[bot] Jul 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,6 @@ ASALocalRun/
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb
healthchecksdb
/DataBase/LearnElasticsearch/wwwroot
/MediatR/LearnMediatR/wwwroot
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/LearnAlgorithm/bin/Debug/netcoreapp3.1/LearnAlgorithm.dll",
"args": [],
"cwd": "${workspaceFolder}/LearnAlgorithm",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
42 changes: 42 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/LearnAlgorithm/LearnAlgorithm.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/LearnAlgorithm/LearnAlgorithm.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/LearnAlgorithm/LearnAlgorithm.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Filters.Controllers
{

/// <summary>
/// test controller
/// </summary>
[SampleActionFilter]
[ApiController]
[Route("[controller]")]
public class ControllerFiltersController : Controller
{
[HttpGet]
public IActionResult Index()
{
Console.WriteLine(
$"- {nameof(ControllerFiltersController)}.{nameof(Index)}");

return Content("Check the Console.");
}

public override void OnActionExecuting(ActionExecutingContext context)
{
Console.WriteLine(
$"- {nameof(ControllerFiltersController)}.{nameof(OnActionExecuting)}");

base.OnActionExecuting(context);
}

public override void OnActionExecuted(ActionExecutedContext context)
{
Console.WriteLine(
$"- {nameof(ControllerFiltersController)}.{nameof(OnActionExecuted)}");

base.OnActionExecuted(context);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Microsoft.AspNetCore.Mvc;

namespace Filters.Controllers
{
[ApiController]
[Route("[controller]")]
[ResponseHeader("Filter-Header", "Filter Value")]
public class ShortCircuitingController : Controller
{
[HttpGet]
[ShortCircuitingResourceFilter]
public IActionResult Index() =>
Content($"- {nameof(ShortCircuitingController)}.{nameof(Index)}");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Microsoft.AspNetCore.Mvc;

namespace Filters.Controllers
{
[ApiController]
[Route("[controller]")]
//将 ResponseHeaderAttribute 添加到控制器或操作方法,并指定 HTTP 标头的名称和值:
[ResponseHeader("Filter-Header", "Filter Value")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

private readonly ILogger<WeatherForecastController> _logger;

public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}

[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}
}
13 changes: 13 additions & 0 deletions ASP.NETCore/Advanced/Filters/Filters.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>

</Project>
144 changes: 144 additions & 0 deletions ASP.NETCore/Advanced/Filters/Filters/SucceededUnifyResultFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Filters
{
/// <summary>
/// 操作筛选器 异步实现
/// </summary>
public class SucceededUnifyResultFilter : IAsyncActionFilter
{
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
// 执行 Action 并获取结果
var actionExecutedContext = await next(); // 具有执行操作方法的 ActionExecutionDelegate (next)

//var result = actionExecutedContext.Result;
//object? data = null;
//// 排除以下结果,跳过规范化处理
//var isDataResult = result switch
//{
// ViewResult => false,
// PartialViewResult => false,
// FileResult => false,
// ChallengeResult => false,
// SignInResult => false,
// SignOutResult => false,
// RedirectToPageResult => false,
// RedirectToRouteResult => false,
// RedirectResult => false,
// RedirectToActionResult => false,
// LocalRedirectResult => false,
// ForbidResult => false,
// ViewComponentResult => false,
// _ => true,
//};

//// 目前支持返回值 ActionResult
//if (isDataResult) data = result switch
//{
// // 处理内容结果
// ContentResult content => content.Content,
// // 处理对象结果
// ObjectResult obj => obj.Value,
// _ => null
//};


////await Task.FromResult("");
//var jsonResult = new JsonResult(new { d = data, m = "hello" });
//actionExecutedContext.Result = jsonResult;
}
public void OnActionExecuted(ActionExecutedContext context)
{
// Do something after the action executes.
}
}

/// <summary>
/// 操作筛选器 同步实现
/// </summary>
public class SampleActionFilter : ActionFilterAttribute
{
//public void OnActionExecuted(ActionExecutedContext context)
//{
// Console.WriteLine("动作方法执行执行之前调用");
//}

//public void OnActionExecuting(ActionExecutingContext context)
//{
// Console.WriteLine("动作方法执行执行之后调用");
//}

}


/// <summary>
/// 异步实现
/// </summary>
public class SampleAsyncActionFilter : IAsyncActionFilter
{
public async Task OnActionExecutionAsync(
ActionExecutingContext context, ActionExecutionDelegate next)
{
// Do something before the action executes.
await next();
// Do something after the action executes.
}
}



/// <summary>
/// 【可子类化和自定义的基于属性的内置筛选器】
/// 结果筛选器会向响应添加标头
/// </summary>
public class ResponseHeaderAttribute : ActionFilterAttribute //多种筛选器接口具有相应属性,这些属性可用作自定义实现的基类。
{
private readonly string _name;
private readonly string _value;
public ResponseHeaderAttribute(string name, string value)
{
_name = name;
_value = value;
}

public override void OnResultExecuting(ResultExecutingContext context)
{
context.HttpContext.Response.Headers.Add(_name, _value);
base.OnResultExecuting(context);
}
}


public class ShortCircuitingResourceFilterAttribute : Attribute, IResourceFilter
{
public void OnResourceExecuted(ResourceExecutedContext context)
{
}

public void OnResourceExecuting(ResourceExecutingContext context)
{
//取消和设置短路
//请求api 直接返回了结果 没有继续执行 action
context.Result = new ContentResult
{
Content = nameof(ShortCircuitingResourceFilterAttribute)
};
}
}


/**
*
* 筛选器属性:
ActionFilterAttribute
ExceptionFilterAttribute
ResultFilterAttribute
FormatFilterAttribute
ServiceFilterAttribute
TypeFilterAttribute
*
*
* **/
}
33 changes: 33 additions & 0 deletions ASP.NETCore/Advanced/Filters/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Filters;
using Microsoft.AspNetCore.Mvc;

//ASP.NET Core 中的筛选器
//https://docs.microsoft.com/zh-cn/aspnet/core/mvc/controllers/filters?view=aspnetcore-6.0

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

builder.Services.Configure<MvcOptions>(options =>
{
options.Filters.Add<SucceededUnifyResultFilter>();
});

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseAuthorization();

app.MapControllers();

app.Run();
31 changes: 31 additions & 0 deletions ASP.NETCore/Advanced/Filters/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:30116",
"sslPort": 0
}
},
"profiles": {
"Filters": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5135",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Loading