对象对象映射器

编程入门 行业动态 更新时间:2024-10-24 12:20:26
本文介绍了对象对象映射器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我用大量的 ORM工具在过去的NHibernate , Tiers , LLBLGEN 多,他们总是做映射数据pretty做好从数据库到code对象。

I've used plenty of ORM tools in the past, NHibernate, Tiers, 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/

更多推荐

对象对象映射器

本文发布于:2023-11-26 17:26:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634501.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对象   映射器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!