zoukankan      html  css  js  c++  java
  • .net core 中使用AutoMapper

    什么是AutoMapper

    • AutoMapper是一个简单的库,旨在解决将一个对象映射到另一个对象

    .Net Core中使用AutoMapper

    • 方式一 直接引入AutoMapper包

    A good way to organize your mapping configurations is with profiles. Create classes that inherit from Profile and put the configuration in the constructor

    官方文档上提到,配置映射关系的最好的方式就是创建一个类,让其继承自Profile,并将配置放入构造函数中

    启动时,在Startup.cs配置文件中配置

    在使用时,通过依赖注入的方式提供实例

    • 方式二,直接添加扩展AutoMapper的扩展库AutoMapper.Extensions.Microsoft.DependencyInjection,更加方便使用

  • 相关阅读:
    科普园地
    专家段 错误 新闻
    16进制转rgb
    图片截取0825
    域名的问题 图片显示不出来
    height cell0809
    添加银行卡
    DeviceDelegateHelper.m
    UUID
    MBProgressHUD 动画
  • 原文地址:https://www.cnblogs.com/move-up/p/13508436.html
Copyright © 2011-2022 走看看