简体   繁体   English

自动化dto翻译

[英]Automating dto translations

In our architecture there are multiple layers and they speak different DTOs, so it common to translate objects with exactly the same properties. 在我们的架构中,有多个层,它们使用不同的DTO,因此通常可以转换具有完全相同属性的对象。

What are the tools/techniques available which help with the laborious task of creating class A which looks like class B and objects of class A are created from objects of class B ? 有哪些工具/技术可以帮助完成创建类A的繁重任务,看起来像是类B ,而类A的对象是从类B对象创建的?

I'm after solutions which would allow me to generate this translating code. 我正在寻找允许我生成这个翻译代码的解决方案。 Keeping two objects always in sync is another issue :) 保持两个对象始终同步是另一个问题:)

I have a Resharper license. 我有Resharper许可证。

AutoMapper is exactly what you want. AutoMapper正是您想要的。

It allows you to setup mapping profiles that map between objects with similar/same properties. 它允许您设置映射配置文件,映射具有相似/相同属性的对象。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM