ASP.NET CORE 实体类映射 AUTOMAPPER
ASP.NET CORE 3.1
1.首先nuget中安装程序包

2.创建继承profile的MappingProfile文件 配置实体类映射(oaEmployee 实体类字段要必须与表中字段一致,testdatamodel 最好与实体类字段一致,如果不一致需添加转换的字段 例: .ForMember(d => d.ISSUENO, opt => opt.MapFrom(src => src.Issueno)) )

3.start类中注册服务

4.Controller中使用

5.index.cshtml中使用

6.页面中显示

注意最后映射类型要一致


浙公网安备 33010602011771号