dto

GWT RPC: DTO vs. DAO?

喜你入骨 提交于 2019-12-10 20:35:30
问题 I've started learning GWT about a week ago and here's the question I can't answer for sure. Here's the server-side: // business object - has logic interface Article { String getTitle(); // lazy void setTitle(); String getText(); // lazy void setText(); Set<Comment> getComments(); // lazy } // also has logic interface Comment { ... } I need to somehow create a GWT widget to visualize Article . Passing Article won't work, since it's not serializable and moreover, it has some BL. So, there are 2

From AutoMapper to Emit Mapper

妖精的绣舞 提交于 2019-12-10 17:29:37
问题 I've recently discovered AutoMapper for bridging ViewModels and my actual DB objects. I use it in the way decribed here: http://automapper.codeplex.com/wikipage?title=Projection&referringTitle=Home I've discovered Emit Mapper to :), but I can't find anytning similar to (where I can specify custom projecting rules): .ForMember(dest => dest.EventDate, opt => opt.MapFrom(src => src.EventDate.Date)) Thanks in advance! 回答1: For the Record this is the best solution that I came across on how to do

Java 中 VO、PO、DTO、BO、POJO、DAO 之间的区别与解释

拥有回忆 提交于 2019-12-10 12:13:16
转载: https://www.cnblogs.com/hunmeng/p/11298680.html VO value object:值对象 通常用于业务层之间的数据传递,由new创建,由GC回收。 PO persistant object:持久层对象 对应数据库中表的字段。 VO和PO,都是属性加上属性的get和set方法;表面看没什么不同,但代表的含义是完全不同的。 DTO data transfer object:数据传输对象。 表里面有十几个字段:id,name,gender(M/F),age,conmpanyId(如001)... 页面需要展示四个字段:name,gender(男/女),age,conmpanyName(如今日头条股份有限公司)。 DTO由此产生,一是能提高数据传输的速度(减少了传输字段),二能隐藏后端表结构。 BO business object:业务对象 BO把业务逻辑封装为一个对象。 我理解是PO的组合,比如投保人是一个PO,被保险人是一个PO,险种信息是一个PO等等,他们组合起来是第一张保单的BO。 POJO plain ordinary java object:简单无规则java对象 纯的传统意义的java对象,最基本的Java Bean只有属性加上属性的get和set方法。 可以转化为PO、DTO、VO;比如POJO在传输过程中就是DTO。

NHibernate, DTOs and NonUniqueObjectException

假装没事ソ 提交于 2019-12-10 11:17:13
问题 We're using the DTO pattern to marshal our domain objects from the service layer into our repository, and then down to the database via NHibernate. I've run into an issue whereby I pull a DTO out of the repository (e.g. CustomerDTO) and then convert it into the domain object (Customer) in my service layer. I then try and save a new object back (e.g. SalesOrder) which contains the same Customer object. This is in turn converted to a SalesOrderDTO (and CustomerDTO) for pushing into the

What is the best practice to deal with navigation properties when using DTO and POCO objects?

ⅰ亾dé卋堺 提交于 2019-12-10 01:54:59
问题 I'm trying to wrap my head around Domain Driven Development. I want to make sure I have a good foundation and understanding of it, so it would be great if recommendations to use AutoMapper or similar are avoided here. My architecture currently involves the following: The WCF service is responsible for persistence (using Entity Framework) and server-side validation. It converts POCO's to DTO's, and DTO's are transferred to the client. The Client, receives DTO's and converts them to POCO's. The

DTO to Entity Mapping Tool

我与影子孤独终老i 提交于 2019-12-09 06:15:39
问题 I have an entity class Person and its corresponding DTO class PersonDto . public class Person: Entity { public virtual string Name { get; set; } public virtual string Phone { get; set; } public virtual string Email { get; set; } public virtual Sex Sex { get; set; } public virtual Position Position { get; set; } public virtual Division Division { get; set; } public virtual Organization Organization { get; set; } } public class PersonDto: Dto { public string Name { get; set; } public string

To use or not to use Data transfer objects(DTO) in a Web Api Chat Application Backend Server

别来无恙 提交于 2019-12-09 02:49:25
问题 I have a chat application backend built using Web Api where I am exposing several database entities directly to clients. I was wondering whether there is any positive points to map the entities to DTOs or should I continue exposing the entities as I am currently. Just to clarify I am not asking a DTO vs non-DTO general question but just advantages of using it in this scenario since most of the fields in the entities would probably be used by the client. 回答1: Yes, you can expose your entities

Using ViewModels instead DTOs as the result of a CQRS query

戏子无情 提交于 2019-12-08 19:16:31
问题 Reading a SO question, I realized that my Read services could provide some smarter object like ViewModels instead plain DTOs. This makes me reconsider what information should be provided by the objects returned by the Read Services Before, using just DTOs, my Read Service just made flat view mapping of a database query into hash like structure with minimum normalization and no behavior. However I tend to think of a ViewModel as something "smarter" that can have generated information not

How to map persistent objects to DTO?

江枫思渺然 提交于 2019-12-08 12:57:59
问题 How to map persistent object to DTO? So that no additional behavior is taken. I know it is quite common and easy, but many people - many opinions, what are the best approaches? (talking about Java) Thanks, 回答1: You could use a object mapper like Dozer. 回答2: You can also use Orika it also support hetrogenous mapping with ease coding. 回答3: Another alternative is MapStruct (disclaimer: I'm the original author of this project). MapStruct generates mapping code at compile-time which is thus fast

is there a way to get rid of DTO

孤街浪徒 提交于 2019-12-08 11:33:43
问题 I am using Entity Framework. I have the following query in which I get data using two tables Application and Employee connected by a foreign key EmployeeID in Application Table. The tables have 1-1 relationship . Is there a way to simplify the following code and get rid of the DTO Employee1 which is the same as auto generated Employee class public List<Employee1> GetApplicant(int ApplicationID) { var context = new FPSDB_newEntities(); var data = (from a in context.Applications join e in