对象对象映射器 [英] Object to object mapper

查看:106
本文介绍了对象对象映射器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用大量的 ORM工具在过去的NHibernate .netTiers ,<一个HREF =htt​​p://en.wikipedia.org/wiki/LLBLGen> LLBLGEN 多,他们总是做映射数据pretty做好从数据库到code对象。

I've used plenty of ORM tools in the past, NHibernate, .netTiers, LLBLGen and more and they always do a pretty good job of mapping data from a database to objects in code.

我要找的,虽然是一个框架或图案或东西,让我从一个类型的对象转换到另一个。

What I'm looking for though is a framework or a pattern or something that will allow me to transform objects from one type to another.

一个例子是我有两个Web服务,人们投资的另一个有成员。我想通过定义一组投资者的属性映射到成员属性,然后再返回规则的投资者对象转换为成员对象。

An example is I have a two web services, one has Investors another has Members. I want to convert an Investor object to a Member object by defining a set of rules that maps the Investor properties to the Member properties and back again.

NHibernate的映射是最接近我能到这样做,但似乎只针对数据库的工作 - >对象映射。我想知道是否有人知道,让我做任何obejct产品 - >对象映射

NHibernate mappings are the closest I can get to doing this, but it only seems to work for Database -> Object mappings. I was wondering if anyone knew of any products that allowed me to do obejct -> object mapping?

推荐答案

您正在寻找AutoMapper

You are looking for AutoMapper

HTTP://automapper.$c$cplex.com/

这篇关于对象对象映射器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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