AutoMapper的基于约定的映射是否与LINQ扩展方法一起使用? [英] Does AutoMapper's convention based mappings work with LINQ extension methods?

查看:252
本文介绍了AutoMapper的基于约定的映射是否与LINQ扩展方法一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我道歉,如果这是一个重复,但我没有找到任何似乎与我寻找的东西匹配。

I apologize if this is a duplicate but I did not find anything that seemed to be matching up with what I am looking for.

我们都知道在Automapper我们可以执行基于约定的映射...

As we all know in Automapper we can perform convention based mappings...

我的问题

My Question

我的实体

My Entities

我想要做的事

Mapper.Map< Store, StoreEditModel >();

public class StoreEditModel
{
    public bool DepartmentsFirstOpen {get;set;}
}

适用使用(所以你不认为我很蠢)

适用的使用是假定集合中的所有项目应处于相同(打开)状态。

The applicable use is to assume that all items in the collection should be in the same (Open)state.

因此,当我的编辑模型恢复被处理时,我可以打开或者关闭商店中的所有部门。

So when my edit model comes back to be processed, I can open or close all Departments in the Store respectively.

外部资源
我已经在AutoMapper的网站上阅读了以下内容....
http://automapper.codeplex.com/wikipage?title=Flattening

推荐答案

看起来像新版本AutoMapper现在支持这样。

Looks like with the new release AutoMapper now supports this.

资料来源: http://automapper.org/blog/2011/09/ 22 / automapper-20-released /

这篇关于AutoMapper的基于约定的映射是否与LINQ扩展方法一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆