当前位置:网站首页>ASP. NET CORE Study03
ASP. NET CORE Study03
2022-06-28 12:30:00 【When the human stars shine】
HTTP Status code
4xx Details of status code 

2xx Status code 
5xx Indicates an internal server error , Can only wait for the internal solution of the server .
about web api It is not necessary to use 1xx The status code , Most of web api Nor can it be used 3xx The status code .
HTTP Method
http There are many methods available , But the most commonly used are the following .
http Method Use , Suggest Use By convention http Method To complete the action .
automapper Use
- install automapper nuget package

- stay startup Configuration class Of ConfigureServices Method registration automapper service .
services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
- newly build profiles Folder , New needs Mapping the class Of profile Class configures mapping relationships in classes .
public class CompanyProfile : Profile
{
public CompanyProfile()
{
CreateMap<Company, CompanyDTO>().ForMember(destinationMember: dest => dest.CompanyName,
memberOptions: opt => opt.MapFrom(mapExpression: src => src.Name));
}
}
Need to introduce AutoMapper as well as The location of the mapped model class namespace.
- Use automapper Do object mapping
var companyDtos = _mapper.Map<IEnumerable<CompanyDTO>>(companies);
need An instantiated automapper object , It's used here Constructor injection . Because before configureservice Method . After obtaining the instantiated object Just call the method .
边栏推荐
- Is there a threshold for opening futures accounts? How to open futures accounts safely on the Internet
- Privilege management of vivo mobile phone
- 2022年理财产品的常见模式有哪些?
- 【Unity编辑器扩展实践】、通过代码查找所有预制
- 华泰证券开户安全吗? 开户有风险吗
- NFT数字藏品系统开发(3D建模经济模型开发案例)
- Given two points and a point with a middle scale, find the coordinates of the point
- 智联招聘基于 Nebula Graph 的推荐实践分享
- 真正的学懂三极管入门篇(经典)「建议收藏」
- 关于字符串转换的一些小技巧
猜你喜欢
随机推荐
杰理之wif 干扰蓝牙【篇】
Unity WebGL移动端去除警告
女子高考落榜读专科逆袭买千万别墅,考得不好真的没关系
运维思考 | 你知道CMDB与监控是什么关系吗?
.NET混合开发解决方案24 WebView2对比CefSharp的超强优势
请问通达信股票软件可靠吗?在上面交易股票安全吗?
几百行代码实现一个 JSON 解析器
newest! Introduction and practical tutorial of point cloud processing based on open3d
真正的学懂三极管入门篇(经典)「建议收藏」
如何获取泛型的类型
【C语言】随机数文件对其进行三种排序方法
Given two points and a point with a middle scale, find the coordinates of the point
Unity导入资源后还手动修改资源的属性?这段代码可以给你节约很多时间:AssetPostprocessor
杰理之wif 干扰蓝牙【篇】
什么是数据合规?怎样做到数据合规?
如何在Microsoft Exchange 2010中安装SSL证书
Jerry's wif interferes with Bluetooth [chapter]
Unity加载设置:Application.backgroundLoadingPriority
分页样式 flex设置成在尾部显示(即使页数加长 也不会因为在末尾而换行)
group_concat学习与配置




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




