当前位置:网站首页>ASP. NET CORE Study04
ASP. NET CORE Study04
2022-06-28 12:35:00 【When the human stars shine】
Binding source Attributes
With the help of binding source attributes You can pass the requested data to api, The details of the attribute Here's the picture .
but stay api Under the project of Marked apicontroller Of controller Next ,binding source attributes The rules of Something has changed 
HttpHEAD
head It is also a kind of http Request method , He followed get The method is very similar . The important difference is head Method does not return body , Only the response header information .
head It can be used to obtain some information on resources .
stay asp.net core Provides HTTP attribute HttpHead Use , Very convenient .
Filter and Search for
Filter : The first is a complete set , Then match them according to the conditions / Unmatched data items are removed .
Search for : The first is an empty set , Then match them according to the conditions / Add unmatched data items to it .
Pay attention to filtration Field of Only right Exposed to the outside world DTO Class .
asp.net core exception handling
Under development mode , Unexpected exception occurred in the program , Prompt information is returned to the user through exception handling , Instead of returning exception information directly , There are hidden dangers in security .
yes startup Class configure Method to configure .
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
// Use useexceptionhandler Middle price to simply handle exceptions
app.UseExceptionHandler(appBuilder =>
{
appBuilder.Run(async context =>
{
context.Response.StatusCode = 500;
await context.Response.Body.WriteAsync(System.Text.Encoding.Default.GetBytes("Unexpected Error"));
});
});
}
http Security and idempotency

HTTP A detailed explanation of each method 
according to http The security and idempotency of methods , What methods can be used to provide references in various business scenarios .
Delivery complexity Action Parameters
When Action When more parameters are required , Pass directly through formal parameters , This leads to very redundant code , So you need to use Model class To accept complex parameters , Handle the transfer of complex parameters .
First of all, you need to declare Model class , Is the basic simple ordinary c# class
public class CompanyDtoParameters
{
public String CompanyName {
get; set; }
public String SearchTerm {
get; set; }
}
Note that the name of the attribute is the key name of the requested data .
And then in service Class and controller Use in


Be careful controller in You need to specify the Data source of model binding .
边栏推荐
- 杰理之wif 干扰蓝牙【篇】
- Mr. Zhang responded to the first live broadcast with goods
- 杰理之wif 干扰蓝牙【篇】
- Map排序工具类
- The paging style flex is set to be displayed at the end (even if the number of pages is longer, there will be no line breaks at the end)
- 【Unity编辑器扩展基础】、GUI
- Wechat authorized login
- PyQt5可视化开发
- Mathematical principle derivation of structured light phase shift method + multifrequency heterodyne
- Ugui force refresh of layout components
猜你喜欢
随机推荐
Unity加载设置:Application.backgroundLoadingPriority
ASP.NET CORE Study06
Unity Editor Extension Foundation, GUI
Siyuan official paid synchronization Guide
我的NVIDIA开发者之旅-Jetson Nano 2gb教你怎么训练模型(完整的模型训练套路)
[unity Editor Extension practice] dynamically generate UI code using TXT template
Matplotlib_ Study01
深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图...
The paging style flex is set to be displayed at the end (even if the number of pages is longer, there will be no line breaks at the end)
杰理之wif 干扰蓝牙【篇】
性能测试-01-简介
What is data compliance? How to achieve data compliance?
Asynctask experience summary
PyQt5可视化开发
Given two points and a point with a middle scale, find the coordinates of the point
Some tips on string conversion
JNI confusion of Android Application Security
ASP.NET CORE Study11
从SimpleKV到Redis
Usage and principle of precomputedtextcompat






![[unity Editor Extension Foundation], editorguilayout (I)](/img/f2/42413a4135fd6181bf311b685504b2.png)


