dto

java面试题:DO DTO VO的区别

拜拜、爱过 提交于 2019-12-26 00:20:35
DO DTO VO的使用 DO :对应数据库表结构 VO :一般用于前端展示使用 DTO :用于数据传递。(接口入参和接口返回值都可以) 以ssm框架为例: controller 层: public List<UserVO> getUsers(UserDTO userDto); Service 层: List<UserDTO> getUsers(UserDTO userDto); DAO 层: List<UserDTO> getUsers(UserDO userDo); 来源: CSDN 作者: Java博客控 链接: https://blog.csdn.net/qq_21118431/article/details/103705271

NServiceBus chokes on Generic DTO

≡放荡痞女 提交于 2019-12-25 11:57:44
问题 If I have a DTO that looks like this: public class MyMessage<TContent> : Message { public TContent Content {get;set;} } NServiceBus chokes trying to dynamically generate concrete definition for TContent at startup - which's obviously impossible - unless it's smart enough to not only parse Types but also opcodes and I don't think we're there yet. Is there a way around this or I simply can't have generics in my DTOs? 来源: https://stackoverflow.com/questions/19258936/nservicebus-chokes-on-generic

Automapper with Entity Framework, Initialization Error

回眸只為那壹抹淺笑 提交于 2019-12-25 07:18:44
问题 I have an EF6 MVC app using Code First to generate the models. I am trying to create a mapping using AutoMapper between the model and a view model representation of that model. However, when I do the mapping I receive the error: Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource

What should keep into this design approach

空扰寡人 提交于 2019-12-25 05:50:16
问题 My Project solution is as below: MVC Project (Containing reference of both projects listed below) WCF Service containing business methods (Containg reference of below listed project) Common Project for DTO or BusinessOBject IN MVC - Calling the WCF service method is as follow - IList<Employee> RetriveData() it is called from MVC - ServiceClient.RetrieveData() , now problem is return object Employee point to ServiceHost.Employee object instead of - Common.DTO.Employee object (Library project)

Mapping nested x-form-urlencoded data to DTO in Asp.NET Core

和自甴很熟 提交于 2019-12-24 09:57:33
问题 Implementing a webhook in Asp.Net Core which is POSTed to with application/x-form-urlencoded data - it's receiving data in a format that is designed to be easily processable in PHP w/ the $_POST variable (nested associative array) - the form fields look like foo bar[barf] baz[bat][bark] baz[bat][bant] Is there a nice (elegant and little code required) way to wire up the Asp.NET Core model binding to handle the nested structure here? i.e. when the webhook gets POSTed to, we parse a C# POCO -

Static methods to transform DTO to Entity

岁酱吖の 提交于 2019-12-24 01:46:12
问题 What is a better approach for implementing converter from DTO to Entity? Using factory with static methods to convert or using instance Converter object? 回答1: Finally I ended with instance Converter objects as they may be mocked, that is better for testing 来源: https://stackoverflow.com/questions/13176707/static-methods-to-transform-dto-to-entity

Dozer Mapping Class level is-accessible

走远了吗. 提交于 2019-12-23 20:37:33
问题 I am using dozer framework for cloning my objects. I want dozer framework to clone the data without using the getters and setters and for this I am setting the is-accessible property at the class level. But this does not seem to work. When I set is-accessible at field level it works fine. BeanMappingBuilder builder = new BeanMappingBuilder(){ @Override protected void configure() { mapping(type(A.class).accessible(true),type(A.class).accessible(true)).exclude("field1").exclude("field2"); } };

Constructing a Domain Object from multiple DTOs

橙三吉。 提交于 2019-12-23 12:37:31
问题 Suppose you have the canonical Customer domain object. You have three different screens on which Customer is displayed: External Admin, Internal Admin, and Update Account. Suppose further that each screen displays only a subset of all of the data contained in the Customer object. The problem is: when the UI passes data back from each screen (e.g. through a DTO), it contains only that subset of a full Customer domain object. So when you send that DTO to the Customer Factory to re-create the

How to expose custom DTO crud repository with Spring data REST?

泄露秘密 提交于 2019-12-23 08:50:11
问题 I don't want to expose my model classes (jpa entities), rather different subset of their attributes with different data transport objects (DTOs). The idea is DTO CrudRepository <-> JpaRepository <-> entities , and I want to expose via Spring Data REST the DTO CrudRepository . Example: Entity: @Entity @Table(name = "groups") public class Group { private Long id; private String name; private Set<User> users; // other attributes @Id @GeneratedValue @Column(name = "group_id") public Long getId()

DDD: DTO usage with different logic

≡放荡痞女 提交于 2019-12-23 05:23:48
问题 I am currently working on a DDD project and recently faced an issue regarding the use of DTOs. I have the following DTO in my domain (code is in php but could be in any language): class TranslationDto { private $locale; private $text; public function getLocale(...); public function getText(...); } The goal is that the UI will give the domain a DTO with a locale and its corresponding text. So for example, if the locale "FR" is not translated, the DTO will look like the following: // UI =>