zoukankan      html  css  js  c++  java
  • AutoMapper

    代码:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using AutoMapper;
    using WebSiteUI.Dto;
    using Domain;
    
    namespace WebSiteUI
    {
        public partial class AutoMapperConfiguration
        {
            /// <summary>
            /// 配置AutoMapper
            /// </summary>
            public static void Config()
            {
                Mapper.CreateMap<MenuDto, S_MENU>();
                Mapper.CreateMap<S_MENU, MenuDto>();
    
                Mapper.CreateMap<UserDto, S_USER>();
                Mapper.CreateMap<S_USER, UserDto>();
            }
    
            /// <summary>
            /// AutoMapper 自定义扩展配置
            /// </summary>
            public static void ConfigExt()
            {
                //Mapper.CreateMap<MenuDto, S_MENU>().ForMember(u => u.M_CODE, e => e.MapFrom(s => s.M_CODE));
                
            }
        }
    }

    global.asax.cs

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using System.Web.Optimization;
    using System.Web.Routing;
    
    namespace WebSiteUI
    {
        public class MvcApplication : Spring.Web.Mvc.SpringMvcApplication
        {
            protected void Application_Start()
            {
                AreaRegistration.RegisterAllAreas();
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
                log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(Server.MapPath("~/log4net.config")));
    
                //AutoMapper
                AutoMapperConfiguration.Config();
                AutoMapperConfiguration.ConfigExt();
            }
        }
    }
  • 相关阅读:
    c++ Knight Moves 超级升级版
    百度招聘彩蛋
    C++ 八数码问题宽搜
    c++ 动态规划(数塔)
    c++ 深度优先搜索(迷宫)
    c++ 宽搜(倒水)
    c++ matrix逆时针螺旋
    c++ 基数排序
    c++ 二分答案(解方程)
    c++ 二分答案(数组查找)
  • 原文地址:https://www.cnblogs.com/xsj1989/p/6924428.html
Copyright © 2011-2022 走看看