data-transfer-objects

Using DTOs and BOs

ε祈祈猫儿з 提交于 2019-12-05 14:22:49
One area of question for me about DTOs/BOs is about when to pass/return the DTOs and when to pass/return the BOs. My gut reaction tells me to always map NHibernate to the DTOs, not BOs, and always pass/return the DTOs. Then whenever I needed to perform business logic, I would convert my DTO into a BO. The way I would do this is that my BO would have a have a constructor that takes a parameter that is the type of my interface (that defines the required fields/properties) that both my DTO and BO implement as the only argument. Then I would be able to create my BO by passing it the DTO in the

Symfony2.1 - The option “em” does not exist when using DataTransformer

痞子三分冷 提交于 2019-12-05 13:13:47
I am using this cookbook recipe to add a data transformer in Symfon 2.1, but I am getting the following error, The option "em" does not exist. Known options are: "attr", "block_name",.... Is this still a valid way to send the entity manager over to the form type? $taskForm = $this->createForm(new TaskType(), $task, array( 'em' => $this->getDoctrine()->getEntityManager(), )); While I can't comment if that's the best way or not, I've always passed them to my task constructor as a hard dependency... Services services: my_bundle.form.type.task: class: Company\MyBundle\Form\Type\TaskType arguments:

What is a DTO and BO? What is the difference?

匆匆过客 提交于 2019-12-05 00:36:59
I know DTO is a data transfer object and a BO is a business object. But, what does it actually mean? When should I choose one over the other? From, what I understand DTO is just used to transfer data and doesn't have business logic. Does this mean that a DTO doesn't have any method only properties(getter and setter)? But, it still has properties of a BO. Can someone please explain? Thanks. DTO is used to transfer data between layers/tiers. For such purpose it doesn't need any methos and sometimes it even should not have any methods - for example when DTO is exposed over web service. Business

Should i use builder pattern in DTO?

。_饼干妹妹 提交于 2019-12-04 11:44:36
问题 This might be a pretty subjetive question, but i would to know some more opinions. I've built a Rest API service with Spring MVC, and i implemented the DTO-Domain-Entity pattern. I want to know what do you think about implementing the Builder pattern in DTOs, something like public class UserResponseDTO extends AbstractResponseDTO { private String username; private Boolean enabled; public UserResponseDTO(String username, Boolean enabled) { this.username = username; this.enabled = enabled; }

Should a WCF service return an EntityObject or a POCO/DTO class?

隐身守侯 提交于 2019-12-04 05:13:29
I've been looking at a lot of WCF examples using EntityFramework and most of them seem to return some kind of POCO or DTO class to the client. I was wondering why this was since the default EntityObject includes the [DataContract] attributes and implements INotifyPropertyChanged . Is returning a DTO or POCO class better than an EntityObject (or vise versa)? And is there specific instances where it is better to use one return value over another? As a best practice, you should definitely have it return a DTO/POCO class that is explicitly designed as a data contract and has no persistence logic.

libusb bulk transfer

时间秒杀一切 提交于 2019-12-03 13:39:05
问题 I am trying to implement user space usb driver using libusb1.0.9. I have lpc2148 blueboard(ARM7) with me..This board is loaded with opensource USB stack/firmware by Mr. Bertrik Sikken. Now my user space driver is trying read write with board. I am getting garbage data. I want to know about the flow of bulk tranfer. For any transfer/transaction is there kernel device driver involved?? and do we need usb gadget device driver also?? I am not able to understand that where the data gets copied.

How much business logic should Value objects contain?

会有一股神秘感。 提交于 2019-12-03 09:17:20
问题 One mentor I respect suggests that a simple bean is a waste of time - that value objects 'MUST' contain some business logic to be useful. Another says such code is difficult to maintain and that all business logic must be externalized. I realize this question is subjective. Asking anyway - want to know answers from more perspectives. 回答1: You should better call them Transfer Objects or Data transfer objects (DTO). Earlier this same j2ee pattern was called 'Value object' but they changed the

what is a good pattern for converting between hibernate entities and data transfer objects?

别来无恙 提交于 2019-12-03 08:31:22
问题 I have had similar questions and concerns as to how to convert between Hibernate entities and data transfer objects to be returned by a web service as are discussed in this question: Is using data transfer objects in ejb3 considered best practice One of the factors mentioned here is that if the domain model changes, a set of DTOs will protect consumers in the case of a web service. Even though it seems like it will add a substantial amount of code to my project, this reasoning seems sound. Is

Difference between Value Object pattern and Data Transfer pattern

荒凉一梦 提交于 2019-12-03 06:16:52
问题 In which scenario can I use those design patterns in n-tier architecture? 回答1: DTO is the object that you can use at the boundaries of the system. When you have a SOAP web service for example and you want to return response you would use DTO. It easier to deal with than actual XML that has to be returned over the wire. DTOs are often generated by tools, based on WSDL for example. DTO are often tailored to the needs of service consumer and can be affected by performance requirements. Value

libusb bulk transfer

不想你离开。 提交于 2019-12-03 03:44:22
I am trying to implement user space usb driver using libusb1.0.9. I have lpc2148 blueboard(ARM7) with me..This board is loaded with opensource USB stack/firmware by Mr. Bertrik Sikken. Now my user space driver is trying read write with board. I am getting garbage data. I want to know about the flow of bulk tranfer. For any transfer/transaction is there kernel device driver involved?? and do we need usb gadget device driver also?? I am not able to understand that where the data gets copied. Important thing is that when I read/write interrupt gets generated and I can see correct data on LCD. Do